From e54d91906640b5d1e49c99aba031f7536cba445e Mon Sep 17 00:00:00 2001 From: Rex Date: Fri, 4 Oct 2024 17:39:13 +0800 Subject: [PATCH] Add offsetX, offsetY parameters --- dist/rexbadgelabel.js | 1 + dist/rexbuttons.js | 32 ++++++++++++----- dist/rexbuttons.min.js | 2 +- dist/rexcolorcomponents.js | 32 ++++++++++++----- dist/rexcolorcomponents.min.js | 2 +- dist/rexcolorinput.js | 33 ++++++++++++----- dist/rexcolorinput.min.js | 2 +- dist/rexcolorpicker.js | 33 ++++++++++++----- dist/rexcolorpicker.min.js | 2 +- dist/rexconfirmdialog.js | 33 ++++++++++++----- dist/rexconfirmdialog.min.js | 4 +-- dist/rexdialog.js | 33 ++++++++++++----- dist/rexdialog.min.js | 2 +- dist/rexdropdownlist.js | 32 ++++++++++++----- dist/rexdropdownlist.min.js | 2 +- dist/rexexpbar.js | 32 ++++++++++++----- dist/rexexpbar.min.js | 2 +- dist/rexfileselectorbutton.js | 32 ++++++++++++----- dist/rexfileselectorbutton.min.js | 2 +- dist/rexfolder.js | 32 ++++++++++++----- dist/rexfolder.min.js | 2 +- dist/rexgameobjectshellplugin.js | 33 ++++++++++++----- dist/rexgameobjectshellplugin.min.js | 2 +- dist/rexgridtable.js | 32 ++++++++++++----- dist/rexgridtable.min.js | 2 +- dist/rexholygrail.js | 32 ++++++++++++----- dist/rexholygrail.min.js | 2 +- dist/rexknob.js | 1 + dist/rexlabel.js | 32 ++++++++++++----- dist/rexlabel.min.js | 2 +- dist/rexmdscenario.js | 33 ++++++++++++----- dist/rexmdscenario.min.js | 8 ++--- dist/rexmdscenarioplugin.js | 33 ++++++++++++----- dist/rexmdscenarioplugin.min.js | 2 +- dist/rexmenu.js | 32 ++++++++++++----- dist/rexmenu.min.js | 2 +- dist/rexnameinputdialog.js | 33 ++++++++++++----- dist/rexnameinputdialog.min.js | 2 +- dist/rexnamevaluelabel.js | 32 ++++++++++++----- dist/rexnamevaluelabel.min.js | 2 +- dist/rexnumberbar.js | 32 ++++++++++++----- dist/rexnumberbar.min.js | 2 +- dist/rexoverlapsizer.js | 1 + dist/rexpages.js | 1 + dist/rexperspectivecard.js | 1 + dist/rexscrollablepanel.js | 32 ++++++++++++----- dist/rexscrollablepanel.min.js | 2 +- dist/rexscrollbar.js | 32 ++++++++++++----- dist/rexscrollbar.min.js | 2 +- dist/rexsides.js | 1 + dist/rexsimpledropdownlist.js | 32 ++++++++++++----- dist/rexsimpledropdownlist.min.js | 2 +- dist/rexsimplelabel.js | 32 ++++++++++++----- dist/rexsimplelabel.min.js | 2 +- dist/rexsizer.js | 32 ++++++++++++----- dist/rexsizer.min.js | 2 +- dist/rexslider.js | 32 ++++++++++++----- dist/rexslider.min.js | 2 +- dist/rexsplitpanels.js | 32 ++++++++++++----- dist/rexsplitpanels.min.js | 2 +- dist/rextabpages.js | 33 ++++++++++++----- dist/rextabpages.min.js | 2 +- dist/rextabs.js | 32 ++++++++++++----- dist/rextabs.min.js | 2 +- dist/rextextarea.js | 32 ++++++++++++----- dist/rextextarea.min.js | 2 +- dist/rextextareainput.js | 32 ++++++++++++----- dist/rextextareainput.min.js | 2 +- dist/rextextbox.js | 32 ++++++++++++----- dist/rextextbox.min.js | 2 +- dist/rextitlelabel.js | 32 ++++++++++++----- dist/rextitlelabel.min.js | 2 +- dist/rextoast.js | 32 ++++++++++++----- dist/rextoast.min.js | 2 +- dist/rextrees.js | 32 ++++++++++++----- dist/rextrees.min.js | 2 +- dist/rextweaker.js | 33 ++++++++++++----- dist/rextweaker.min.js | 2 +- dist/rexuiplugin.js | 33 ++++++++++++----- dist/rexuiplugin.min.js | 2 +- examples/test/test-ui.js | 37 ++++++++++++++++++++ templates/ui/overlapsizer/AddChildMethods.js | 1 + templates/ui/sizer/AddChildMethods.js | 13 +++++++ templates/ui/sizer/LayoutChildren.js | 19 +++++----- templates/ui/sizer/Sizer.d.ts | 4 +++ 85 files changed, 1012 insertions(+), 345 deletions(-) diff --git a/dist/rexbadgelabel.js b/dist/rexbadgelabel.js index c18fd97a40..c9ec62d10e 100644 --- a/dist/rexbadgelabel.js +++ b/dist/rexbadgelabel.js @@ -12171,6 +12171,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexbuttons.js b/dist/rexbuttons.js index 99dc878b52..4166675822 100644 --- a/dist/rexbuttons.js +++ b/dist/rexbuttons.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$3(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$3(config, 'offsetX', 0); + offsetY = GetValue$3(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexbuttons.min.js b/dist/rexbuttons.min.js index c630b6d147..a2bff2073a 100644 --- a/dist/rexbuttons.min.js +++ b/dist/rexbuttons.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return hi(t,0,1)}set t(t){(t=hi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var o={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new xi(t,o):r.resetFromJSON(o),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new xi(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var o,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},h={x:i};break;case 1:case"y":o={y:t.scaleX},h={y:i};break;default:o=t.scaleX,h=i}var l={mode:2,start:o,end:h,duration:e/2,ease:n,repeat:s};return void 0===a?a=new xi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,a):s.resetFromJSON(a),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Yi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,ji),Bi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Vi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Vi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Vi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ui&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Ji(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Ji(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new Ui(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ui&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Ji(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Ji(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new Ui(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class hs extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new hs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Rs,Ms,Ls,zs);const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ns.prototype,As);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class js extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Us extends js{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ns{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class Pr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var wr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=wn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case wn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case On:this.tracerState=wn,this.onDrag1End();break;case Tn:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=wn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,We);var _n={};const wn=0,On=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(In(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=zn(In(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Xn="IDLE",Yn="BEGIN",jn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ar.call(t,e),Fr.call(t,e),jr.call(t,e),Vr.call(t,e),Wn.call(t,e),Vn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var h=ne(e,"name",!1);h&&(r=ne(h,"createTextCallback",oe),n=ne(h,"createTextCallbackScope",void 0),"string"==typeof(a=ne(h,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,ha={min:0,full:-1};var la=function(t,e,i,s,r,n,a,o,h,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ha[e];else if(na(e)){var u;e=aa(u=e,"proportion",void 0),i=aa(u,"align",oa),s=aa(u,"padding",0),r=aa(u,"expand",!1),n=aa(u,"key",void 0),a=aa(u,"index",void 0),t.isRexSizer||(o=aa(u,"minWidth",void 0),h=aa(u,"minHeight",void 0)),l=aa(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ca=Ot.prototype.clear;var ua=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ca.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ua.call(this,t),this}},ga={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,ga,fa,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ea=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class Pa extends Kn{constructor(t,e,i,s,r,n,a){Ea(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Ea(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Ea(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(Pa.prototype,ba);const _a=Pa.prototype.add,wa=Pa.prototype.addSpace;var Oa=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&wa.call(this),_a.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&wa.call(this),this.hasTailSpace=s}else _a.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;_a.call(this,t,{index:r,proportion:i,expand:!0})}else _a.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ta={addButton(t){if(or(t))for(var e=t,i=0,s=e.length;i=0;i--)Ra.call(this,e[i],t);return this}},La=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},za=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,La.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Aa={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),za.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},we=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return we(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return we(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return hi(t,0,1)}set t(t){(t=hi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var o={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new xi(t,o):r.resetFromJSON(o),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new xi(t,a):n.resetFromJSON(a),n.restart(),n},wi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return wi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var o,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},h={x:i};break;case 1:case"y":o={y:t.scaleX},h={y:i};break;default:o=t.scaleX,h=i}var l={mode:2,start:o,end:h,duration:e/2,ease:n,repeat:s};return void 0===a?a=new xi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,ji),Bi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Vi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Vi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Vi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ui&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Ji(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Ji(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new Ui(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ui&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Ji(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Ji(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new Ui(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class hs extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new hs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),wi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Rs,Ms,Ls,zs);const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ns.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Ys extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class js extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Us extends js{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},$s=function(t,e){Yi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ns{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},ar=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class Pr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:ar)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ar(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ar(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case wn:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ar(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ar(t,s,e,i)}}Object.assign(Pn.prototype,We);var _n={};const On=0,wn=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(In(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=zn(In(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Yn="IDLE",Fn="BEGIN",jn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ar.call(t,e),Xr.call(t,e),jr.call(t,e),Vr.call(t,e),Wn.call(t,e),Vn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var h=ne(e,"name",!1);h&&(r=ne(h,"createTextCallback",oe),n=ne(h,"createTextCallbackScope",void 0),"string"==typeof(a=ne(h,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,ha={min:0,full:-1};var la=function(t,e,i,s,r,n,a,o,h,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ha[e];else if(na(e)){var v;e=aa(v=e,"proportion",void 0),i=aa(v,"align",oa),s=aa(v,"padding",0),r=aa(v,"expand",!1),n=aa(v,"key",void 0),a=aa(v,"index",void 0),t.isRexSizer||(o=aa(v,"minWidth",void 0),h=aa(v,"minHeight",void 0)),l=aa(v,"fitRatio",0),d=aa(v,"offsetX",0),c=aa(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ca=wt.prototype.clear;var ua=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ca.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ua.call(this,t),this}},ga={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,ga,fa,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ea=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class Pa extends Kn{constructor(t,e,i,s,r,n,a){Ea(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Ea(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Ea(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(Pa.prototype,ba);const _a=Pa.prototype.add,Oa=Pa.prototype.addSpace;var wa=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Oa.call(this),_a.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Oa.call(this),this.hasTailSpace=s}else _a.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;_a.call(this,t,{index:r,proportion:i,expand:!0})}else _a.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ta={addButton(t){if(or(t))for(var e=t,i=0,s=e.length;i=0;i--)Ra.call(this,e[i],t);return this}},La=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},za=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,La.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Aa={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),za.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexcolorcomponents.min.js b/dist/rexcolorcomponents.min.js index 7c02516857..4e8a838fb5 100644 --- a/dist/rexcolorcomponents.min.js +++ b/dist/rexcolorcomponents.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},ze=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Xi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=zi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const zi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class zs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;let js=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new zs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const zn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Wr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=ah[e];else if(rh(e)){var c;e=nh(c=e,"proportion",void 0),i=nh(c,"align",hh),s=nh(c,"padding",0),r=nh(c,"expand",!1),n=nh(c,"key",void 0),h=nh(c,"index",void 0),t.isRexSizer||(a=nh(c,"minWidth",void 0),o=nh(c,"minHeight",void 0)),l=nh(c,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ce(s),c.expand=r,c.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,u=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ze.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=u,f=c,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ch=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends qn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=xh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Ph=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Th={appendText:Ph,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Sh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,Th);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Wh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof Wh},zh=function(t){return Xh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=0,Nh=1,Vh=2,Gh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Gh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qh=Phaser.Display.Color;var ta={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var u=d.cutWidth,c=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=u),void 0===n&&(n=c),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=u),void 0===l&&(l=c);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ea=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var u=d.getContext("2d",{willReadFrequently:!0});u.clearRect(0,0,n,h),u.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ia={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ea(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=na(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ss(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class la{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(la.prototype,oa);var da={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ua=Phaser.Math.RotateAround;var ca;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=e,s.y=i,0!==t.rotation&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const xa=Phaser.GameObjects.Components.TransformMatrix;var ba,Ca,wa={},Sa=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ba&&(ba=new xa,Ca=new xa),t.parentContainer?t.getWorldTransformMatrix(ba,Ca):ba.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ba.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Sa(t,e,n,h,r)},Pa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ca&&(ca={}),s=ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ua(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const Ta=Phaser.Math.DegToRad,_a=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return _a(this._rotation)}set angle(t){this.rotation=Ta(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Wa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Wa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Wa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Wa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},Wa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=c.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,u=l):(t.lineTo(0,0),d=0,u=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,u),t.closePath(),t.restore()}(e,i,s,r,n,h,c),null!=a)&&(null!=d&&((p=u?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ha=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Va extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ga=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ga(e,"color",null),Ga(e,"color2",null),Ga(e,"horizontalGradient",!0)),this.setStroke(Ga(e,"stroke",null),Ga(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ga(t,"color2",null),Ga(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;let Ja=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class uo extends Ea{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){lo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class co extends Ea{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class po extends Ea{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class vo extends la{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=go(t[i]));return e}var fo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mo={none:0,word:1,char:2,character:2,mix:3};var yo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,u=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=wo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,u=Oo(t,"wrapMode");void 0===u&&(u=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof u&&(u=mo[u]);var c=Oo(t,"wrapWidth",void 0);void 0===c&&(this.fixedWidth>0?c=this.fixedWidth-r:(c=1/0,u=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:c,wrapMode:u}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_o(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_o(t,"maxLines",0);var a=0===i,o=_o(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_o(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var u=_o(t,"wrapHeight",void 0);void 0===u&&(u=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var c=_o(t,"letterSpacing",0),p=_o(t,"rtl",!0),v=_o(t,"hAlign",p?2:0),g=_o(t,"vAlign",0),f=fo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:c,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:u,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var u=0,c=o.length;u0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Oa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ll=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const dl=Phaser.Utils.Objects.GetValue,ul=Phaser.Utils.Objects.GetValue;class cl extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ul(e,"background",void 0),r=ul(e,"icon",void 0),n=ul(e,"iconMask",void 0),h=ul(e,"text",void 0),a=ul(e,"action",void 0),o=ul(e,"actionMask",void 0),l=ul(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ul(e,"space.icon",0),top:ul(e,"space.iconTop",0),bottom:ul(e,"space.iconBottom",0),left:ul(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ul(e,"space.icon",0),left:ul(e,"space.iconLeft",0),right:ul(e,"space.iconRight",0),top:ul(e,"space.iconTop",0)});var d=ul(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var u=ul(e,"iconSize",void 0);this.setIconSize(ul(e,"iconWidth",u),ul(e,"iconHeight",u))}}if(h){var c=ul(e,"wrapText",!1),p=ul(e,"adjustTextFontSize",!1);c?(!0===c&&(c="word"),function(t,e){switch(zh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,c),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ul(e,"space.text",0),m=ul(e,"expandTextWidth",!1),y=ul(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ul(e,"space.actionTop",0),bottom:ul(e,"space.actionBottom",0),right:ul(e,"space.actionRight",0)}:{left:ul(e,"space.actionLeft",0),right:ul(e,"space.actionRight",0),bottom:ul(e,"space.actionBottom",0)},d=ul(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var x=ul(e,"actionSize");this.setActionSize(ul(e,"actionWidth",x),ul(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},xl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const bl=Phaser.Renderer.Canvas.SetTransform;var Cl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&vl(r,h,e,l,a,o),e.isStroked&&fl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(bl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Sl.prototype,Cl);var Ol=function(t){return t.x>0&&t.y>0},Pl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Tl=Phaser.Math.DegToRad;var _l=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const kd=Phaser.Utils.Objects.GetValue,Ed=Phaser.Utils.Objects.IsPlainObject;class Md extends(ed(Ul)){constructor(t,e,i,s,r,n,h,a){Ed(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ed(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ed(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(kd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(kd(a,"trackStrokeThickness",2),kd(a,"trackStrokeColor",void 0)),this.setSkewX(kd(a,"skewX",0)),this.setRTL(kd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Rd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&_d(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),_d(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_d(a,0,0,e,i,t)}};Object.assign(Md.prototype,Rd);var Ld=function(t){return null==t||""===t||0===t.length},Dd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ld(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ld(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=go(i),s=go(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var g=(c-v)*o;d>=0?d+=g:d=g,c=v}if(p>v){var f=(p-v)*l;u>=0?u+=f:u=f,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return qd(t)?(this.stretchMode.edge=Qd(Zd(t,"edge",0)),this.stretchMode.internal=Qd(Zd(t,"internal",0))):(t=Qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return eu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const su=Phaser.Utils.Objects.IsPlainObject,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.GameObjects;var hu=void 0,au=function(t,e){if(hu||(hu={},qe(t).events.once("destroy",(function(){for(var t in hu)hu[t].destroy();hu=void 0}))),!hu.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new nu[e](i)).setOrigin(0),hu[e]=t}return hu[e]};const ou=Phaser.GameObjects.RenderTexture;class lu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(su(i)?(i=ru(d=i,"x",0),s=ru(d,"y",0),r=ru(d,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(r)?(r=ru(d=r,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(h)?(h=ru(d=h,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(a)?(a=ru(d=a,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ru(d,"baseFrame",void 0)):su(o)&&(o=ru(d=o,"columns",void 0),l=ru(d,"rows",void 0)),void 0===a&&(a=ru(d,"frame",void 0)),void 0===o){var u=ru(d,"leftWidth",void 0),c=ru(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=ru(d,"topHeight",void 0),v=ru(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ru(d,"getFrameNameCallback",void 0)),this.setStretchMode(ru(d,"stretchMode",0)),this.setPreserveRatio(ru(d,"preserveRatio",!0));var g=ru(d,"maxFixedPartScale",1),f=ru(d,"maxFixedPartScaleX",g),m=ru(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,iu),i}(ou,"rexNinePatch")){}var du={_drawImage:function(t,e,i,s,r,n){var h=au(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=au(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(lu.prototype,du);let uu=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wd(t,e))return t[e];var i=t.parent;return Wd(i,e)?i[e]:void 0}set(t,e,i){return Wd(t,e)?t[e]=i:Wd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const cu=Phaser.Utils.Objects.GetValue;class pu extends lu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=cu(e,"effects",!0);i&&Id(this,i),this.style=new uu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(pu.prototype,Fl);const vu=["alpha","tint","flipX","flipY"];var gu=function(t,e){if(!e)return t;for(var i=0,s=vu.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},ze=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Xi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=zi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const zi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class zs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;let js=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new zs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const zn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Wr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,u){ve.call(this,t);var c=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),u=nh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(c?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(c?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=u,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,u=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ze.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=u,f=c,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ch=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends qn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=xh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Ph=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Th={appendText:Ph,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class _h extends Sh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(_h.prototype,Th);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Wh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof Wh},zh=function(t){return Xh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=0,Nh=1,Vh=2,Gh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Gh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qh=Phaser.Display.Color;var ta={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var u=d.cutWidth,c=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=u),void 0===n&&(n=c),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=u),void 0===l&&(l=c);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ea=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var u=d.getContext("2d",{willReadFrequently:!0});u.clearRect(0,0,n,h),u.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ia={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ea(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=na(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ss(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class la{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(la.prototype,oa);var da={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ua=Phaser.Math.RotateAround;var ca;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=e,s.y=i,0!==t.rotation&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const xa=Phaser.GameObjects.Components.TransformMatrix;var ba,Ca,wa={},Sa=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ba&&(ba=new xa,Ca=new xa),t.parentContainer?t.getWorldTransformMatrix(ba,Ca):ba.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ba.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Sa(t,e,n,h,r)},Pa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ca&&(ca={}),s=ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ua(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const Ta=Phaser.Math.DegToRad,_a=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return _a(this._rotation)}set angle(t){this.rotation=Ta(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Wa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Wa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Wa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Wa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},Wa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=c.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,u=l):(t.lineTo(0,0),d=0,u=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,u),t.closePath(),t.restore()}(e,i,s,r,n,h,c),null!=a)&&(null!=d&&((p=u?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ha=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Va extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ga=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ga(e,"color",null),Ga(e,"color2",null),Ga(e,"horizontalGradient",!0)),this.setStroke(Ga(e,"stroke",null),Ga(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ga(t,"color2",null),Ga(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;let Ja=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class uo extends Ea{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){lo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class co extends Ea{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class po extends Ea{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class vo extends la{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=go(t[i]));return e}var fo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mo={none:0,word:1,char:2,character:2,mix:3};var yo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,u=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=wo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,u=Oo(t,"wrapMode");void 0===u&&(u=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof u&&(u=mo[u]);var c=Oo(t,"wrapWidth",void 0);void 0===c&&(this.fixedWidth>0?c=this.fixedWidth-r:(c=1/0,u=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:c,wrapMode:u}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_o(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_o(t,"maxLines",0);var a=0===i,o=_o(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_o(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var u=_o(t,"wrapHeight",void 0);void 0===u&&(u=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var c=_o(t,"letterSpacing",0),p=_o(t,"rtl",!0),v=_o(t,"hAlign",p?2:0),g=_o(t,"vAlign",0),f=fo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:c,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:u,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var u=0,c=o.length;u0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Oa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ll=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const dl=Phaser.Utils.Objects.GetValue,ul=Phaser.Utils.Objects.GetValue;class cl extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ul(e,"background",void 0),r=ul(e,"icon",void 0),n=ul(e,"iconMask",void 0),h=ul(e,"text",void 0),a=ul(e,"action",void 0),o=ul(e,"actionMask",void 0),l=ul(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ul(e,"space.icon",0),top:ul(e,"space.iconTop",0),bottom:ul(e,"space.iconBottom",0),left:ul(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ul(e,"space.icon",0),left:ul(e,"space.iconLeft",0),right:ul(e,"space.iconRight",0),top:ul(e,"space.iconTop",0)});var d=ul(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var u=ul(e,"iconSize",void 0);this.setIconSize(ul(e,"iconWidth",u),ul(e,"iconHeight",u))}}if(h){var c=ul(e,"wrapText",!1),p=ul(e,"adjustTextFontSize",!1);c?(!0===c&&(c="word"),function(t,e){switch(zh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,c),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ul(e,"space.text",0),m=ul(e,"expandTextWidth",!1),y=ul(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ul(e,"space.actionTop",0),bottom:ul(e,"space.actionBottom",0),right:ul(e,"space.actionRight",0)}:{left:ul(e,"space.actionLeft",0),right:ul(e,"space.actionRight",0),bottom:ul(e,"space.actionBottom",0)},d=ul(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var x=ul(e,"actionSize");this.setActionSize(ul(e,"actionWidth",x),ul(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},xl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const bl=Phaser.Renderer.Canvas.SetTransform;var Cl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&vl(r,h,e,l,a,o),e.isStroked&&fl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(bl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Sl.prototype,Cl);var Ol=function(t){return t.x>0&&t.y>0},Pl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Tl=Phaser.Math.DegToRad;var _l=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const kd=Phaser.Utils.Objects.GetValue,Ed=Phaser.Utils.Objects.IsPlainObject;class Md extends(ed(Ul)){constructor(t,e,i,s,r,n,h,a){Ed(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ed(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ed(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(kd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(kd(a,"trackStrokeThickness",2),kd(a,"trackStrokeColor",void 0)),this.setSkewX(kd(a,"skewX",0)),this.setRTL(kd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Rd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&_d(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),_d(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_d(a,0,0,e,i,t)}};Object.assign(Md.prototype,Rd);var Ld=function(t){return null==t||""===t||0===t.length},Dd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ld(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ld(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=go(i),s=go(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var g=(c-v)*o;d>=0?d+=g:d=g,c=v}if(p>v){var f=(p-v)*l;u>=0?u+=f:u=f,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return qd(t)?(this.stretchMode.edge=Qd(Zd(t,"edge",0)),this.stretchMode.internal=Qd(Zd(t,"internal",0))):(t=Qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return eu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const su=Phaser.Utils.Objects.IsPlainObject,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.GameObjects;var hu=void 0,au=function(t,e){if(hu||(hu={},qe(t).events.once("destroy",(function(){for(var t in hu)hu[t].destroy();hu=void 0}))),!hu.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new nu[e](i)).setOrigin(0),hu[e]=t}return hu[e]};const ou=Phaser.GameObjects.RenderTexture;class lu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(su(i)?(i=ru(d=i,"x",0),s=ru(d,"y",0),r=ru(d,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(r)?(r=ru(d=r,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(h)?(h=ru(d=h,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(a)?(a=ru(d=a,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ru(d,"baseFrame",void 0)):su(o)&&(o=ru(d=o,"columns",void 0),l=ru(d,"rows",void 0)),void 0===a&&(a=ru(d,"frame",void 0)),void 0===o){var u=ru(d,"leftWidth",void 0),c=ru(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=ru(d,"topHeight",void 0),v=ru(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ru(d,"getFrameNameCallback",void 0)),this.setStretchMode(ru(d,"stretchMode",0)),this.setPreserveRatio(ru(d,"preserveRatio",!0));var g=ru(d,"maxFixedPartScale",1),f=ru(d,"maxFixedPartScaleX",g),m=ru(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,iu),i}(ou,"rexNinePatch")){}var du={_drawImage:function(t,e,i,s,r,n){var h=au(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=au(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(lu.prototype,du);let uu=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wd(t,e))return t[e];var i=t.parent;return Wd(i,e)?i[e]:void 0}set(t,e,i){return Wd(t,e)?t[e]=i:Wd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const cu=Phaser.Utils.Objects.GetValue;class pu extends lu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=cu(e,"effects",!0);i&&Id(this,i),this.style=new uu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(pu.prototype,Fl);const vu=["alpha","tint","flipX","flipY"];var gu=function(t,e){if(!e)return t;for(var i=0,s=vu.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexcolorinput.js b/dist/rexcolorinput.js index 27be9e0307..537a488547 100644 --- a/dist/rexcolorinput.js +++ b/dist/rexcolorinput.js @@ -12192,7 +12192,7 @@ var LayoutChildren$3 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$Y(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$Y(config, 'offsetX', 0); + offsetY = GetValue$Y(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -21251,6 +21267,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexcolorinput.min.js b/dist/rexcolorinput.min.js index 775723234f..d06e7f9458 100644 --- a/dist/rexcolorinput.min.js +++ b/dist/rexcolorinput.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const ke=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Hi),Gi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,As);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Xs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Fs=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Ns={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Ns.popUp;break;case Zs.fadeIn:t=Ns.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Ns.scaleDown;break;case Zs.fadeOut:t=Ns.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Nr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Nr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Nr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var Pn={};const On=0,kn=1,Tn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Yn=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(zn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(zn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Xn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Gn.call(t,e),Nn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=_t.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ch=function(t){return"string"==typeof t&&(t=bh[t]),t};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ch(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=xh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,yh);var Oh=Phaser.Renderer.WebGL.Utils,kh=function(t,e,i,s,r,n){for(var h=Oh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Rh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Lh=Phaser.Renderer.Canvas.SetTransform;var Dh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Eh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&kh(r,h,e,l,a,o),e.isStroked&&_h(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Lh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(zh.prototype,Dh);const Yh=Phaser.Utils.Objects.GetValue;let Wh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Yh(t,"x",0),i=Yh(t,"y",0));var s=this.cornerRadius;s.tl=Xh(Yh(t,"tl",void 0),e,i),s.tr=Xh(Yh(t,"tr",void 0),e,i),s.bl=Xh(Yh(t,"bl",void 0),e,i),s.br=Xh(Yh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jh(this.cornerRadius.br,t)}};var Xh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fh(t),t},jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Yh(e,"x",0),t.y=Yh(e,"y",0)),Fh(t)},Fh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ih=function(t){return t.x>0&&t.y>0},Bh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Hh=Phaser.Math.DegToRad;var Gh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_a.prototype,Pa);const Ea=Phaser.Utils.String.Pad;var Ma=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ea(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ra=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const La=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},Aa=function(t){return t.x>0&&t.y>0},za=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,l,o,l,180,270,!1,h):za(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,l,o,l,270,360,!1,h):za(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,r-l,o,l,0,90,!1,h):za(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,r-l,o,l,90,180,!1,h):za(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Wa=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Xa=Phaser.Utils.Objects.GetValue;class ja extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2)),this.setCornerRadius(Xa(e,"cornerRadius",0),Xa(e,"cornerIteration",null))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ra("color2",t,this),Ra("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ra("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ra("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Wa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ba=Phaser.Utils.Objects.GetValue;let Ha=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ra("stroke",t,this),Ra("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ra("shadowOffsetX",t,this),Ra("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ma(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ma(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ma(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ma(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ga=Phaser.Utils.Array.Remove,Va=Phaser.Utils.Array.Remove,Na="text",Ua="image",$a="drawer",Ja="space",qa="command";var Ka=function(t){return t.type===Na&&"\n"===t.text},Za=function(t){return t.type===Na&&"\f"===t.text},Qa=function(t){return t.type===Na};class to extends _a{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new Ha(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var eo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const io=Phaser.Display.Canvas.CanvasPool;var so=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=io.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),io.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ro extends _a{constructor(t,e,i){super(t,Ua),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){so(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class no extends _a{constructor(t,e,i,s){super(t,$a),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ho extends _a{constructor(t,e){super(t,Ja),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class ao extends oa{constructor(t,e,i,s,r){super(t,qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>oo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=oo(t[i]));return e}var lo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const co={none:0,word:1,char:2,character:2,mix:3};var uo=/^[\x00-\x7F]+$/,po=function(t){return uo.test(t)},vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=bo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=bo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=bo(t,"wrapMode");void 0===c&&(c=bo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=co[c]);var u=bo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=bo(t,"letterSpacing",0),v=bo(t,"hAlign",0),g=bo(t,"vAlign",0),f=bo(t,"justifyPercentage",.25),m=lo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=So(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=So(t,"maxLines",0);var a=0===i,o=So(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=So(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=So(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=So(t,"letterSpacing",0),p=So(t,"rtl",!0),v=So(t,"hAlign",p?2:0),g=So(t,"vAlign",0),f=lo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ga(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Va(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Na);return null===i?i=new to(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(xl(this),bl(this)),this}setNumberInput(){return this.onUpdateCallback=yl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Sl=Phaser.Utils.Objects.GetValue,Pl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ol=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Wl.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Xl(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const jl=new Wl,Fl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Il=/\S/,Bl=new Wl;Bl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Il.test(t)&&!Il.test(e)},Bl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Nl(t,null,null,i),i," ")},Vl.equals=function(t,e){return Wl.prototype.equals.call(Vl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ul=new Wl;Ul.tokenize=function(t){return t.slice()},Ul.join=Ul.removeEmpty=function(t){return t};const $l=Phaser.Utils.Array.Remove;var Jl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$l(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,jl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},td={cursorMoveLeft(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ed=Phaser.Utils.Objects.IsPlainObject;class id extends Qo{constructor(t,e,i,s,r,n){ed(e)?n=e:ed(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ol(e,"wrap.vAlign")||Tl(e,"wrap.vAlign",s=i?"center":"top"),Ol(e,"wrap.wrapMode")||Tl(e,"wrap.wrapMode","char"),Ol(e,"wrap.maxLines")||Tl(e,"wrap.maxLines",s=i?1:void 0),i&&Tl(e,"wrap.wrapWidth",1/0),Ol(e,"wrap.useDefaultTextHeight")||Tl(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ol(e.edit,"inputType")){var s=i?"text":"textarea";Tl(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new El(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ml(n.background,"focus"),o=Ml(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Sl(e,"edit");return void 0===i&&(i={}),il(e,i,Pl),new wl(t,i)}(this,n),Rl.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Yl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),zl.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Od(r)?(d.expandWidth=kd(r,"width",!1),d.expandHeight=kd(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Md={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ch.call(this,t),this}},Rd={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,dr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Sd.width=e.aspectRatio,Sd.height=1,Pd.width=a,Pd.height=o,a=(l=bd(Sd,Pd,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),Zn(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,cr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Rd,Ed,Md);const Ld=Phaser.Utils.Objects.IsPlainObject,Dd=Phaser.Utils.Objects.GetValue;class Ad extends Kn{constructor(t,e,i,s,r,n){Ld(e)?(e=Dd(n=e,"x",0),i=Dd(n,"y",0),s=Dd(n,"width",void 0),r=Dd(n,"height",void 0)):Ld(s)&&(s=Dd(n=s,"width",void 0),r=Dd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Ad.prototype,Rd);var zd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Yd extends na{}Object.assign(Yd.prototype,zd);const Wd=Phaser.Display.Color,Xd=Phaser.Math.Percent,jd=Phaser.Display.Color,Fd=Phaser.Math.Percent,Id=Phaser.Display.Color.ColorToRGBA,Bd=Phaser.Display.Color.HSVToRGB;class Hd extends Yd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new jd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Ch(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Wd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Cc=0,wc=1,Sc=2,Pc=0,Oc=1,kc=2,Tc=/(?:\r\n|\r|\n)/;const _c={none:Pc,word:Oc,char:kc,character:kc,mix:3};var Ec=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof Qo}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):mc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return gc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Mc=65535;var Rc=function(t,e,i){if(null==e)return t;if(0===e)return Ac(t,0,i),t;var s=t.text.length;if(0===s)return Ac(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=Dc(t,r,e,i,n),a=0;a<=Mc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Dc(t,r,e,i,n)}return a===Mc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ac(t,e,i),t},Lc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Dc=function(t,e,i,s,r){var n,h=Lc(t,e,r),a=Lc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Ac=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zc=Phaser.Utils.Objects.GetValue,Yc=Phaser.Utils.Objects.GetValue;class Wc extends oc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Yc(e,"background",void 0),r=Yc(e,"icon",void 0),n=Yc(e,"iconMask",void 0),h=Yc(e,"text",void 0),a=Yc(e,"action",void 0),o=Yc(e,"actionMask",void 0),l=Yc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Yc(e,"space.icon",0),top:Yc(e,"space.iconTop",0),bottom:Yc(e,"space.iconBottom",0),left:Yc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Yc(e,"space.icon",0),left:Yc(e,"space.iconLeft",0),right:Yc(e,"space.iconRight",0),top:Yc(e,"space.iconTop",0)});var d=Yc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=pc.call(this,r,r,1)),!d){var c=Yc(e,"iconSize",void 0);this.setIconSize(Yc(e,"iconWidth",c),Yc(e,"iconHeight",c))}}if(h){var u=Yc(e,"wrapText",!1),p=Yc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(yc(t)){case 0:switch("string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Ec(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zc(e,"minWidth",0),s=zc(e,"minHeight",0),r=zc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Rc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Rc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Yc(e,"space.text",0),m=Yc(e,"expandTextWidth",!1),y=Yc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Yc(e,"space.actionTop",0),bottom:Yc(e,"space.actionBottom",0),right:Yc(e,"space.actionRight",0)}:{left:Yc(e,"space.actionLeft",0),right:Yc(e,"space.actionRight",0),bottom:Yc(e,"space.actionBottom",0)},d=Yc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=pc.call(this,a,a,1)),!d)){var x=Yc(e,"actionSize");this.setActionSize(Yc(e,"actionWidth",x),Yc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Xc=Phaser.Utils.Objects.GetValue;class jc extends Qe{constructor(t,e){super(t,e),this.style=Xc(e,"style",this);var i=Xc(e,"propertiesMap");this.activeStyle=Fc(e,"active",i),this.hoverStyle=Fc(e,"hover",i),this.disableStyle=Fc(e,"disable",i),this.onModifyStyle=Xc(e,"onModifyStyle")}getStyle(t){return Dl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Al(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Ic.call(this,"active",t),this}setHoverState(t){return Ic.call(this,"hover",t),this}setDisableState(t){return Ic.call(this,"disable",t),this}}var Fc=function(t,e,i){var s=Ml(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Ic=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},Bc={addStyleManager(t){return this.styleManager=new jc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Hc extends $h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Gc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Gc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Hc.prototype,Bc);const Vc=Phaser.GameObjects.GetCalcMatrix,Nc=Phaser.Renderer.Canvas.SetTransform;var Uc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.Utils.Objects.IsPlainObject;class Du extends(ru(qc)){constructor(t,e,i,s,r,n,h,a){Lu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Lu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Lu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Eu).setName("trackFill")).addShape((new Eu).setName("bar")).addShape((new Eu).setName("trackStroke")),this.setTrackColor(Ru(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ru(a,"trackStrokeThickness",2),Ru(a,"trackStrokeColor",void 0)),this.setSkewX(Ru(a,"skewX",0)),this.setRTL(Ru(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Au={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Mu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Mu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Mu(a,0,0,e,i,t)}};Object.assign(Du.prototype,Au);class zu extends Du{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Tl(e,"easeValue.duration",e.easeDuration),Tl(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Yu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Yu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zu.prototype,Bc);var Wu=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Xu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},ju=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=oo(i),s=oo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==P&&"number"!==P||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zu(t)?(this.stretchMode.edge=tp(Qu(t,"edge",0)),this.stretchMode.internal=tp(Qu(t,"internal",0))):(t=tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ip.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Utils.Objects.GetValue,hp=Phaser.GameObjects;var ap=void 0,op=function(t,e){if(ap||(ap={},Ke(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new hp[e](i)).setOrigin(0),ap[e]=t}return ap[e]};const lp=Phaser.GameObjects.RenderTexture;class dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rp(i)?(i=np(d=i,"x",0),s=np(d,"y",0),r=np(d,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(r)?(r=np(d=r,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(h)?(h=np(d=h,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(a)?(a=np(d=a,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=np(d,"baseFrame",void 0)):rp(o)&&(o=np(d=o,"columns",void 0),l=np(d,"rows",void 0)),void 0===a&&(a=np(d,"frame",void 0)),void 0===o){var c=np(d,"leftWidth",void 0),u=np(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=np(d,"topHeight",void 0),v=np(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(np(d,"getFrameNameCallback",void 0)),this.setStretchMode(np(d,"stretchMode",0)),this.setPreserveRatio(np(d,"preserveRatio",!0));var g=np(d,"maxFixedPartScale",1),f=np(d,"maxFixedPartScaleX",g),m=np(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sp),i}(lp,"rexNinePatch")){}var cp={_drawImage:function(t,e,i,s,r,n){var h=op(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=op(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dp.prototype,cp);let up=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pp=Phaser.Utils.Objects.GetValue;class vp extends dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pp(e,"effects",!0);i&&Bu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,Bc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const ke=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Hi),Gi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,As);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Xs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Fs=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Ns={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Ns.popUp;break;case Zs.fadeIn:t=Ns.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Ns.scaleDown;break;case Zs.fadeOut:t=Ns.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Nr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Nr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Nr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var Pn={};const On=0,kn=1,Tn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Yn=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(zn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(zn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Xn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Gn.call(t,e),Nn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=_t.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ch=function(t){return"string"==typeof t&&(t=bh[t]),t};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ch(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=xh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,yh);var Oh=Phaser.Renderer.WebGL.Utils,kh=function(t,e,i,s,r,n){for(var h=Oh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Rh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Lh=Phaser.Renderer.Canvas.SetTransform;var Dh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Eh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&kh(r,h,e,l,a,o),e.isStroked&&_h(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Lh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(zh.prototype,Dh);const Yh=Phaser.Utils.Objects.GetValue;let Wh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Yh(t,"x",0),i=Yh(t,"y",0));var s=this.cornerRadius;s.tl=Xh(Yh(t,"tl",void 0),e,i),s.tr=Xh(Yh(t,"tr",void 0),e,i),s.bl=Xh(Yh(t,"bl",void 0),e,i),s.br=Xh(Yh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jh(this.cornerRadius.br,t)}};var Xh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fh(t),t},jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Yh(e,"x",0),t.y=Yh(e,"y",0)),Fh(t)},Fh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ih=function(t){return t.x>0&&t.y>0},Bh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Hh=Phaser.Math.DegToRad;var Gh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_a.prototype,Pa);const Ea=Phaser.Utils.String.Pad;var Ma=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ea(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ra=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const La=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},Aa=function(t){return t.x>0&&t.y>0},za=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,l,o,l,180,270,!1,h):za(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,l,o,l,270,360,!1,h):za(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,r-l,o,l,0,90,!1,h):za(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,r-l,o,l,90,180,!1,h):za(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Wa=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Xa=Phaser.Utils.Objects.GetValue;class ja extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2)),this.setCornerRadius(Xa(e,"cornerRadius",0),Xa(e,"cornerIteration",null))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ra("color2",t,this),Ra("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ra("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ra("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Wa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ba=Phaser.Utils.Objects.GetValue;let Ha=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ra("stroke",t,this),Ra("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ra("shadowOffsetX",t,this),Ra("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ma(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ma(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ma(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ma(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ga=Phaser.Utils.Array.Remove,Va=Phaser.Utils.Array.Remove,Na="text",Ua="image",$a="drawer",Ja="space",qa="command";var Ka=function(t){return t.type===Na&&"\n"===t.text},Za=function(t){return t.type===Na&&"\f"===t.text},Qa=function(t){return t.type===Na};class to extends _a{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new Ha(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var eo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const io=Phaser.Display.Canvas.CanvasPool;var so=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=io.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),io.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ro extends _a{constructor(t,e,i){super(t,Ua),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){so(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class no extends _a{constructor(t,e,i,s){super(t,$a),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ho extends _a{constructor(t,e){super(t,Ja),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class ao extends oa{constructor(t,e,i,s,r){super(t,qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>oo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=oo(t[i]));return e}var lo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const co={none:0,word:1,char:2,character:2,mix:3};var uo=/^[\x00-\x7F]+$/,po=function(t){return uo.test(t)},vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=bo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=bo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=bo(t,"wrapMode");void 0===c&&(c=bo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=co[c]);var u=bo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=bo(t,"letterSpacing",0),v=bo(t,"hAlign",0),g=bo(t,"vAlign",0),f=bo(t,"justifyPercentage",.25),m=lo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=So(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=So(t,"maxLines",0);var a=0===i,o=So(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=So(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=So(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=So(t,"letterSpacing",0),p=So(t,"rtl",!0),v=So(t,"hAlign",p?2:0),g=So(t,"vAlign",0),f=lo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ga(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Va(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Na);return null===i?i=new to(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(xl(this),bl(this)),this}setNumberInput(){return this.onUpdateCallback=yl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Sl=Phaser.Utils.Objects.GetValue,Pl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ol=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Wl.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Xl(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const jl=new Wl,Fl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Il=/\S/,Bl=new Wl;Bl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Il.test(t)&&!Il.test(e)},Bl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Nl(t,null,null,i),i," ")},Vl.equals=function(t,e){return Wl.prototype.equals.call(Vl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ul=new Wl;Ul.tokenize=function(t){return t.slice()},Ul.join=Ul.removeEmpty=function(t){return t};const $l=Phaser.Utils.Array.Remove;var Jl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$l(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,jl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},td={cursorMoveLeft(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ed=Phaser.Utils.Objects.IsPlainObject;class id extends Qo{constructor(t,e,i,s,r,n){ed(e)?n=e:ed(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ol(e,"wrap.vAlign")||Tl(e,"wrap.vAlign",s=i?"center":"top"),Ol(e,"wrap.wrapMode")||Tl(e,"wrap.wrapMode","char"),Ol(e,"wrap.maxLines")||Tl(e,"wrap.maxLines",s=i?1:void 0),i&&Tl(e,"wrap.wrapWidth",1/0),Ol(e,"wrap.useDefaultTextHeight")||Tl(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ol(e.edit,"inputType")){var s=i?"text":"textarea";Tl(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new El(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ml(n.background,"focus"),o=Ml(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Sl(e,"edit");return void 0===i&&(i={}),il(e,i,Pl),new wl(t,i)}(this,n),Rl.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Yl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),zl.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Od(r)?(d.expandWidth=kd(r,"width",!1),d.expandHeight=kd(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Md={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ch.call(this,t),this}},Rd={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,dr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Sd.width=e.aspectRatio,Sd.height=1,Pd.width=a,Pd.height=o,a=(l=bd(Sd,Pd,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),Zn(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,cr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Rd,Ed,Md);const Ld=Phaser.Utils.Objects.IsPlainObject,Dd=Phaser.Utils.Objects.GetValue;class Ad extends Kn{constructor(t,e,i,s,r,n){Ld(e)?(e=Dd(n=e,"x",0),i=Dd(n,"y",0),s=Dd(n,"width",void 0),r=Dd(n,"height",void 0)):Ld(s)&&(s=Dd(n=s,"width",void 0),r=Dd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Ad.prototype,Rd);var zd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Yd extends na{}Object.assign(Yd.prototype,zd);const Wd=Phaser.Display.Color,Xd=Phaser.Math.Percent,jd=Phaser.Display.Color,Fd=Phaser.Math.Percent,Id=Phaser.Display.Color.ColorToRGBA,Bd=Phaser.Display.Color.HSVToRGB;class Hd extends Yd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new jd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Ch(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Wd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Cc=0,wc=1,Sc=2,Pc=0,Oc=1,kc=2,Tc=/(?:\r\n|\r|\n)/;const _c={none:Pc,word:Oc,char:kc,character:kc,mix:3};var Ec=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof Qo}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):mc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return gc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Mc=65535;var Rc=function(t,e,i){if(null==e)return t;if(0===e)return Ac(t,0,i),t;var s=t.text.length;if(0===s)return Ac(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=Dc(t,r,e,i,n),a=0;a<=Mc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Dc(t,r,e,i,n)}return a===Mc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ac(t,e,i),t},Lc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Dc=function(t,e,i,s,r){var n,h=Lc(t,e,r),a=Lc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Ac=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zc=Phaser.Utils.Objects.GetValue,Yc=Phaser.Utils.Objects.GetValue;class Wc extends oc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Yc(e,"background",void 0),r=Yc(e,"icon",void 0),n=Yc(e,"iconMask",void 0),h=Yc(e,"text",void 0),a=Yc(e,"action",void 0),o=Yc(e,"actionMask",void 0),l=Yc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Yc(e,"space.icon",0),top:Yc(e,"space.iconTop",0),bottom:Yc(e,"space.iconBottom",0),left:Yc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Yc(e,"space.icon",0),left:Yc(e,"space.iconLeft",0),right:Yc(e,"space.iconRight",0),top:Yc(e,"space.iconTop",0)});var d=Yc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=pc.call(this,r,r,1)),!d){var c=Yc(e,"iconSize",void 0);this.setIconSize(Yc(e,"iconWidth",c),Yc(e,"iconHeight",c))}}if(h){var u=Yc(e,"wrapText",!1),p=Yc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(yc(t)){case 0:switch("string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Ec(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zc(e,"minWidth",0),s=zc(e,"minHeight",0),r=zc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Rc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Rc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Yc(e,"space.text",0),m=Yc(e,"expandTextWidth",!1),y=Yc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Yc(e,"space.actionTop",0),bottom:Yc(e,"space.actionBottom",0),right:Yc(e,"space.actionRight",0)}:{left:Yc(e,"space.actionLeft",0),right:Yc(e,"space.actionRight",0),bottom:Yc(e,"space.actionBottom",0)},d=Yc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=pc.call(this,a,a,1)),!d)){var x=Yc(e,"actionSize");this.setActionSize(Yc(e,"actionWidth",x),Yc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Xc=Phaser.Utils.Objects.GetValue;class jc extends Qe{constructor(t,e){super(t,e),this.style=Xc(e,"style",this);var i=Xc(e,"propertiesMap");this.activeStyle=Fc(e,"active",i),this.hoverStyle=Fc(e,"hover",i),this.disableStyle=Fc(e,"disable",i),this.onModifyStyle=Xc(e,"onModifyStyle")}getStyle(t){return Dl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Al(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Ic.call(this,"active",t),this}setHoverState(t){return Ic.call(this,"hover",t),this}setDisableState(t){return Ic.call(this,"disable",t),this}}var Fc=function(t,e,i){var s=Ml(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Ic=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},Bc={addStyleManager(t){return this.styleManager=new jc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Hc extends $h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Gc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Gc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Hc.prototype,Bc);const Vc=Phaser.GameObjects.GetCalcMatrix,Nc=Phaser.Renderer.Canvas.SetTransform;var Uc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.Utils.Objects.IsPlainObject;class Du extends(ru(qc)){constructor(t,e,i,s,r,n,h,a){Lu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Lu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Lu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Eu).setName("trackFill")).addShape((new Eu).setName("bar")).addShape((new Eu).setName("trackStroke")),this.setTrackColor(Ru(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ru(a,"trackStrokeThickness",2),Ru(a,"trackStrokeColor",void 0)),this.setSkewX(Ru(a,"skewX",0)),this.setRTL(Ru(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Au={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Mu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Mu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Mu(a,0,0,e,i,t)}};Object.assign(Du.prototype,Au);class zu extends Du{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Tl(e,"easeValue.duration",e.easeDuration),Tl(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Yu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Yu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zu.prototype,Bc);var Wu=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Xu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},ju=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=oo(i),s=oo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==P&&"number"!==P||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zu(t)?(this.stretchMode.edge=tp(Qu(t,"edge",0)),this.stretchMode.internal=tp(Qu(t,"internal",0))):(t=tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ip.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Utils.Objects.GetValue,hp=Phaser.GameObjects;var ap=void 0,op=function(t,e){if(ap||(ap={},Ke(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new hp[e](i)).setOrigin(0),ap[e]=t}return ap[e]};const lp=Phaser.GameObjects.RenderTexture;class dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rp(i)?(i=np(d=i,"x",0),s=np(d,"y",0),r=np(d,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(r)?(r=np(d=r,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(h)?(h=np(d=h,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(a)?(a=np(d=a,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=np(d,"baseFrame",void 0)):rp(o)&&(o=np(d=o,"columns",void 0),l=np(d,"rows",void 0)),void 0===a&&(a=np(d,"frame",void 0)),void 0===o){var c=np(d,"leftWidth",void 0),u=np(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=np(d,"topHeight",void 0),v=np(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(np(d,"getFrameNameCallback",void 0)),this.setStretchMode(np(d,"stretchMode",0)),this.setPreserveRatio(np(d,"preserveRatio",!0));var g=np(d,"maxFixedPartScale",1),f=np(d,"maxFixedPartScaleX",g),m=np(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sp),i}(lp,"rexNinePatch")){}var cp={_drawImage:function(t,e,i,s,r,n){var h=op(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=op(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dp.prototype,cp);let up=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pp=Phaser.Utils.Objects.GetValue;class vp extends dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pp(e,"effects",!0);i&&Bu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,Bc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexcolorpicker.js b/dist/rexcolorpicker.js index 82d0d87d68..d5bbfadeef 100644 --- a/dist/rexcolorpicker.js +++ b/dist/rexcolorpicker.js @@ -12192,7 +12192,7 @@ var LayoutChildren$1 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$6(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$6(config, 'offsetX', 0); + offsetY = GetValue$6(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -13187,6 +13203,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexcolorpicker.min.js b/dist/rexcolorpicker.min.js index 677bcd61ca..39a8abdf75 100644 --- a/dist/rexcolorpicker.min.js +++ b/dist/rexcolorpicker.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},R={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const we=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},De=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,h):s.resetFromJSON(h),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,as=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=as(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ds={};Object.assign(Ds,Es,ks,Rs,Ms);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ds);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?As(e):t};class Is extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=As(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Vs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Hs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Gs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Bs.popUp;break;case qs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Bs.scaleDown;break;case qs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const wr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Br,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Br=0,Hr=1,Vr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var an={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,an);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=wn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case wn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var xn={};const Sn=0,Pn=1,wn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var On=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const kn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Dn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Dn(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Dn(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const An="IDLE",In="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Bn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Bn(e,"targets",[t]),targetMode:Bn(e,"targetMode","parent"),eventEmitter:Bn(e,"eventEmitter",t),eventNamePrefix:Bn(e,"inputEventPrefix","child.")},Mr.call(t,e),zr.call(t,e),Fr.call(t,e),Nr.call(t,e),Yn.call(t,e),Nn.call(t,e),Un.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",ae),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(h=ne(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const eh=Phaser.Utils.Objects.IsPlainObject,ih=Phaser.Utils.Objects.GetValue,sh=Phaser.Display.Align.CENTER,rh={min:0,full:-1};var nh=function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=rh[e];else if(eh(e)){var u;e=ih(u=e,"proportion",void 0),i=ih(u,"align",sh),s=ih(u,"padding",0),r=ih(u,"expand",!1),n=ih(u,"key",void 0),h=ih(u,"index",void 0),t.isRexSizer||(a=ih(u,"minWidth",void 0),o=ih(u,"minHeight",void 0)),l=ih(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},hh={add:nh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),nh.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return eh(i)&&(i.index=t),nh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=th.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ah=Ot.prototype.clear;var oh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ah.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oh.call(this,t),this}},ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},uh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ph={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},vh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},gh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(gh,hh,dh,ch,uh,ph,vh);var fh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},mh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},yh=function(t){return"string"==typeof t&&(t=mh[t]),t};const Ch=Phaser.Utils.Objects.IsPlainObject,bh=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=bh(h=e,"x",0),i=bh(h,"y",0),s=bh(h,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(s)?(s=bh(h=s,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(n)&&(n=bh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(bh(h,"space.item",0)),this.setStartChildIndex(bh(h,"startChildIndex",0)),this.setRTL(bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=yh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,gh);var Sh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Ph[i])}void 0===s?s={}:!0===s&&(s=wh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Ph={fit:0,FIT:0,envelop:1,ENVELOP:1};var wh={},Th={},_h={};const Oh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,kh=Phaser.Display.Align.CENTER,Rh=Phaser.Utils.String.UUID;var Mh={add:function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t),Oh(e)&&(e=Eh(d=e,"key",void 0),i=Eh(d,"align",kh),s=Eh(d,"padding",0),r=Eh(d,"expand",!0),t.isRexSizer||(n=Eh(d,"minWidth",t._minWidth),h=Eh(d,"minHeight",t._minHeighted)),a=Eh(d,"offsetX",0),o=Eh(d,"offsetY",0),l=Eh(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Rh()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=kh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Oh(r)?(d.expandWidth=Eh(r,"width",!1),d.expandHeight=Eh(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Dh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return oh.call(this,t),this}},Lh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,or.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Th.width=e.aspectRatio,Th.height=1,_h.width=a,_h.height=o,a=(l=Sh(Th,_h,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),$n(t,this)):Ye(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,lr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Lh,Mh,Dh);const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue;class Ih extends Jn{constructor(t,e,i,s,r,n){zh(e)?(e=Ah(n=e,"x",0),i=Ah(n,"y",0),s=Ah(n,"width",void 0),r=Ah(n,"height",void 0)):zh(s)&&(s=Ah(n=s,"width",void 0),r=Ah(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Ih.prototype,Lh);const Fh=Phaser.Renderer.WebGL.Utils;var Xh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Fh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Yh=Phaser.Display.Color;var jh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Yh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Nh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Wh=Phaser.Display.Canvas.CanvasPool,Uh=Phaser.GameObjects.GameObject,Bh=Phaser.Utils.String.UUID;let Hh=class extends Uh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Wh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Bh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Wh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Vh=Phaser.GameObjects.Components;Phaser.Class.mixin(Hh,[Vh.Alpha,Vh.BlendMode,Vh.Crop,Vh.Depth,Vh.Flip,Vh.GetBounds,Vh.Mask,Vh.Origin,Vh.Pipeline,Vh.PostPipeline,Vh.ScrollFactor,Vh.Tint,Vh.Transform,Vh.Visible,Xh,jh,Nh]);var Gh={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Jh extends Hh{}Object.assign(Jh.prototype,Gh);const $h=Phaser.Display.Color,qh=Phaser.Math.Percent,Zh=Phaser.Display.Color,Kh=Phaser.Math.Percent,Qh=Phaser.Display.Color.ColorToRGBA,ta=Phaser.Display.Color.HSVToRGB;class ea extends Jh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Zh,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=yh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new $h;if(i)for(var h=0;h>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"}(r,e),r.fill()),e.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth}(r,e),r.stroke()),r.restore()}}};const oa=Phaser.GameObjects.Shape;class la extends oa{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(la.prototype,aa);const da=Phaser.Utils.Objects.GetValue;let ca=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=da(t,"x",0),i=da(t,"y",0));var s=this.cornerRadius;s.tl=ua(da(t,"tl",void 0),e,i),s.tr=ua(da(t,"tr",void 0),e,i),s.bl=ua(da(t,"bl",void 0),e,i),s.br=ua(da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){pa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){pa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){pa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){pa(this.cornerRadius.br,t)}};var ua=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),va(t),t},pa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=da(e,"x",0),t.y=da(e,"y",0)),va(t)},va=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ga=function(t){return t.x>0&&t.y>0},fa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ma=Phaser.Math.DegToRad;var ya=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},R={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const we=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},De=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Pi(t,h):r.resetFromJSON(h),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Pi(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Pi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Vi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Vi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Vi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Vi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ds={};Object.assign(Ds,Es,ks,Rs,Ms);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ds);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?As(e):t};class Is extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=As(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Vs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Hs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Gs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Bs.popUp;break;case qs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Bs.scaleDown;break;case qs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const wr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Br,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Br=0,Hr=1,Vr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=wn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case wn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var xn={};const Sn=0,Pn=1,wn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var On=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const kn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Dn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Dn(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Dn(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const An="IDLE",In="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Bn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Bn(e,"targets",[t]),targetMode:Bn(e,"targetMode","parent"),eventEmitter:Bn(e,"eventEmitter",t),eventNamePrefix:Bn(e,"inputEventPrefix","child.")},Mr.call(t,e),zr.call(t,e),Fr.call(t,e),Nr.call(t,e),Yn.call(t,e),Nn.call(t,e),Un.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ra[e];else if(ea(e)){var v;e=ia(v=e,"proportion",void 0),i=ia(v,"align",sa),s=ia(v,"padding",0),r=ia(v,"expand",!1),n=ia(v,"key",void 0),a=ia(v,"index",void 0),t.isRexSizer||(h=ia(v,"minWidth",void 0),o=ia(v,"minHeight",void 0)),l=ia(v,"fitRatio",0),d=ia(v,"offsetX",0),c=ia(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},ya=function(t){return"string"==typeof t&&(t=ma[t]),t};const Ca=Phaser.Utils.Objects.IsPlainObject,ba=Phaser.Utils.Objects.GetValue;class xa extends Jn{constructor(t,e,i,s,r,n,a){Ca(e)?(e=ba(a=e,"x",0),i=ba(a,"y",0),s=ba(a,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(s)?(s=ba(a=s,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(n)&&(n=ba(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(ba(a,"space.item",0)),this.setStartChildIndex(ba(a,"startChildIndex",0)),this.setRTL(ba(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=ya(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}Object.assign(xa.prototype,ga);var Sa=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Pa[i])}void 0===s?s={}:!0===s&&(s=wa);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Pa={fit:0,FIT:0,envelop:1,ENVELOP:1};var wa={},Ta={},_a={};const Oa=Phaser.Utils.Objects.IsPlainObject,Ea=Phaser.Utils.Objects.GetValue,ka=Phaser.Display.Align.CENTER,Ra=Phaser.Utils.String.UUID;var Ma={add:function(t,e,i,s,r,n,a,h,o,l){ue.call(this,t),Oa(e)&&(e=Ea(d=e,"key",void 0),i=Ea(d,"align",ka),s=Ea(d,"padding",0),r=Ea(d,"expand",!0),t.isRexSizer||(n=Ea(d,"minWidth",t._minWidth),a=Ea(d,"minHeight",t._minHeighted)),h=Ea(d,"offsetX",0),o=Ea(d,"offsetY",0),l=Ea(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Ra()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=ka),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Oa(r)?(d.expandWidth=Ea(r,"width",!1),d.expandHeight=Ea(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),d.alignOffsetX=h,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Da={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return oa.call(this,t),this}},La={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,or.call(this,t),h=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ta.width=e.aspectRatio,Ta.height=1,_a.width=h,_a.height=o,h=(l=Sa(Ta,_a,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,h,o),$n(t,this)):Ye(t,h,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,lr.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(La,Ma,Da);const za=Phaser.Utils.Objects.IsPlainObject,Aa=Phaser.Utils.Objects.GetValue;class Ia extends Jn{constructor(t,e,i,s,r,n){za(e)?(e=Aa(n=e,"x",0),i=Aa(n,"y",0),s=Aa(n,"width",void 0),r=Aa(n,"height",void 0)):za(s)&&(s=Aa(n=s,"width",void 0),r=Aa(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Ia.prototype,La);const Fa=Phaser.Renderer.WebGL.Utils;var Xa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Fa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ya=Phaser.Display.Color;var ja={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ya);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Na={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Wa=Phaser.Display.Canvas.CanvasPool,Ua=Phaser.GameObjects.GameObject,Ba=Phaser.Utils.String.UUID;let Ha=class extends Ua{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Wa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ba(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Wa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Va=Phaser.GameObjects.Components;Phaser.Class.mixin(Ha,[Va.Alpha,Va.BlendMode,Va.Crop,Va.Depth,Va.Flip,Va.GetBounds,Va.Mask,Va.Origin,Va.Pipeline,Va.PostPipeline,Va.ScrollFactor,Va.Tint,Va.Transform,Va.Visible,Xa,ja,Na]);var Ga={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Ja extends Ha{}Object.assign(Ja.prototype,Ga);const $a=Phaser.Display.Color,qa=Phaser.Math.Percent,Za=Phaser.Display.Color,Ka=Phaser.Math.Percent,Qa=Phaser.Display.Color.ColorToRGBA,th=Phaser.Display.Color.HSVToRGB;class eh extends Ja{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Za,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=ya(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new $a;if(i)for(var a=0;a>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"}(r,e),r.fill()),e.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth}(r,e),r.stroke()),r.restore()}}};const oh=Phaser.GameObjects.Shape;class lh extends oh{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(lh.prototype,hh);const dh=Phaser.Utils.Objects.GetValue;let ch=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=dh(t,"x",0),i=dh(t,"y",0));var s=this.cornerRadius;s.tl=uh(dh(t,"tl",void 0),e,i),s.tr=uh(dh(t,"tr",void 0),e,i),s.bl=uh(dh(t,"bl",void 0),e,i),s.br=uh(dh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ph(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ph(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ph(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ph(this.cornerRadius.br,t)}};var uh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),vh(t),t},ph=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=dh(e,"x",0),t.y=dh(e,"y",0)),vh(t)},vh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},gh=function(t){return t.x>0&&t.y>0},fh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const mh=Phaser.Math.DegToRad;var yh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -13187,6 +13203,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index ade2d11ab1..f4fd10a5b6 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Be={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Bi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Bi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Bi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Bi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},zs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Bs={};Object.assign(Bs,Ds,zs,As,Ys);const Ws=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,Bs);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Dr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},zr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Kr=0,qr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return qe(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const xn="IDLE",Sn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;kn.x=e.x-i.x,kn.y=e.y-i.y}else kn.x=0,kn.y=0;return kn}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,Ge);var kn={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Bn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Bn(Xn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Bn(Xn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Hn="BEGIN",Nn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Br.call(t,e),jr.call(t,e),Hr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=kt.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,ph,mh,yh,bh,xh,Sh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class kh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(kh.prototype,Ch);var Eh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},Dh={};const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Bh=Phaser.Utils.String.UUID;var Wh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),zh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Bh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),zh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Se.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return gh.call(this,t),this}},jh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,Dh.width=a,Dh.height=o,a=(l=Eh(Lh,Dh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Wh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Hh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Hh.prototype,jh);const Nh=kh.prototype.add,Gh=kh.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Gh.call(this),Nh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Nh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Nh.call(this,t,{index:r,proportion:i,expand:!0})}else Nh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Qh=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Qh.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},xa={add(t,e,i){if(lr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},wa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Ba=Phaser.Utils.Objects.GetValue;class Wa extends ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new aa({parent:this,eventEmitter:Ba(e,"eventEmitter",this),groupName:Ba(e,"groupName",void 0),clickConfig:Ba(e,"click",void 0)}).setButtonsType(e);var s=Ba(e,"background",void 0),r=Ba(e,"buttons",void 0);this.buttonsAlign=Ba(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Wa.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Ha=Phaser.Display.Align.CENTER;var Na=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Za={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},jo=0,Io=1,Fo=2,Ho=0,No=1,Go=2,Vo=/(?:\r\n|\r|\n)/;const Uo={none:Ho,word:No,char:Go,character:Go,mix:3},$o=Phaser.Renderer.WebGL.Utils;var Jo={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=$o.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ko=Phaser.Display.Color;var qo={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ko);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Zo=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},Qo={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Zo(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const tl=Phaser.Display.Canvas.CanvasPool,el=Phaser.GameObjects.GameObject,il=Phaser.Utils.String.UUID;class sl extends el{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=tl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=il(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){tl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const rl=Phaser.GameObjects.Components;Phaser.Class.mixin(sl,[rl.Alpha,rl.BlendMode,rl.Crop,rl.Depth,rl.Flip,rl.GetBounds,rl.Mask,rl.Origin,rl.Pipeline,rl.PostPipeline,rl.ScrollFactor,rl.Tint,rl.Transform,rl.Visible,Jo,qo,Qo]);var nl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class hl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(hl.prototype,nl);var al={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ol=Phaser.Math.RotateAround;var ll;const dl=Phaser.Geom.Rectangle;var cl,ul=function(t){void 0===cl&&(cl=new dl);var e=t.drawTLX,i=t.drawTLY;return cl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),cl};const pl=Phaser.Math.RotateAround;var vl,gl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),s.x=e,s.y=i,0!==t.rotation&&pl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const fl=Phaser.GameObjects.Components.TransformMatrix;var ml,yl,bl={},xl=function(t,e,i,s,r){var n=gl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=bl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ml&&(ml=new fl,yl=new fl),t.parentContainer?t.getWorldTransformMatrix(ml,yl):ml.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ml.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return xl(t,e,n,h,r)},Cl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ll&&(ll={}),s=ll),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ol(s,0,0,-i.rotation),s}(t,e,this,!0);return ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sl(this.parent,this,t,e,i)}};Object.assign(Cl,al);const wl=Phaser.Math.DegToRad,Ol=Phaser.Math.RadToDeg,Pl=Phaser.Utils.Objects.GetValue;class _l extends hl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ol(this._rotation)}set angle(t){this.rotation=wl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Pl(t,"width",void 0),i=Pl(t,"height",void 0),s=Pl(t,"scaleX",void 0),r=Pl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_l.prototype,Cl);const Tl=Phaser.Utils.String.Pad;var kl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Tl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},El=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ml=Phaser.Utils.Objects.GetValue;let Rl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ml(t,"x",0),i=Ml(t,"y",0));var s=this.cornerRadius;s.tl=Ll(Ml(t,"tl",void 0),e,i),s.tr=Ll(Ml(t,"tr",void 0),e,i),s.bl=Ll(Ml(t,"bl",void 0),e,i),s.br=Ll(Ml(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Dl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Dl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Dl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Dl(this.cornerRadius.br,t)}};var Ll=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),zl(t),t},Dl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ml(e,"x",0),t.y=Ml(e,"y",0)),zl(t)},zl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Al=Phaser.Math.DegToRad;var Yl=function(t){return!t.hasOwnProperty("convex")||t.convex},Bl=function(t){return t.x>0&&t.y>0},Wl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,l,o,l,180,270,!1,h):Wl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,l,o,l,270,360,!1,h):Wl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,r-l,o,l,0,90,!1,h):Wl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,r-l,o,l,90,180,!1,h):Wl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},jl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Xl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Il=Phaser.Utils.Objects.GetValue;class Fl extends _l{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Il(e,"color",null),Il(e,"color2",null),Il(e,"horizontalGradient",!0)),this.setStroke(Il(e,"stroke",null),Il(e,"strokeThickness",2)),this.setCornerRadius(Il(e,"cornerRadius",0),Il(e,"cornerIteration",null))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=kl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,El("color2",t,this),El("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,El("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,El("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){jl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Hl=Phaser.Utils.Objects.GetValue;class Nl extends _l{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Hl(e,"color",null),Hl(e,"color2",null),Hl(e,"horizontalGradient",!0)),this.setStroke(Hl(e,"stroke",null),Hl(e,"strokeThickness",2))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=kl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Hl(t,"color2",null),Hl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Hl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Gl=Phaser.Utils.Objects.GetValue;let Vl=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Gl(t,"bold",!1)),this.setItalic(Gl(t,"italic",!1)),this.setFontSize(Gl(t,"fontSize","16px")),this.setFontFamily(Gl(t,"fontFamily","Courier")),this.setColor(Gl(t,"color","#fff")),this.setStrokeStyle(Gl(t,"stroke",null),Gl(t,"strokeThickness",0)),this.setShadow(Gl(t,"shadowColor",null),Gl(t,"shadowOffsetX",0),Gl(t,"shadowOffsetY",0),Gl(t,"shadowBlur",0)),this.setOffset(Gl(t,"offsetX",0),Gl(t,"offsetY",0)),this.setSpace(Gl(t,"leftSpace",0),Gl(t,"rightSpace",0)),this.setAlign(Gl(t,"align",void 0)),this.setBackgroundColor(Gl(t,"backgroundColor",null)),this.setBackgroundHeight(Gl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Gl(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(El("stroke",t,this),El("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(El("shadowOffsetX",t,this),El("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=kl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=kl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=kl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=kl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ul=Phaser.Utils.Array.Remove,$l=Phaser.Utils.Array.Remove,Jl="text",Kl="image",ql="drawer",Zl="space",Ql="command";var td=function(t){return t.type===Jl&&"\n"===t.text},ed=function(t){return t.type===Jl&&"\f"===t.text},id=function(t){return t.type===Jl};class sd extends _l{constructor(t,e,i){super(t,Jl),this.updateTextFlag=!1,this.style=new Vl(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var rd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const nd=Phaser.Display.Canvas.CanvasPool;var hd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=nd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),nd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ad extends _l{constructor(t,e,i){super(t,Kl),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){hd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class od extends _l{constructor(t,e,i,s){super(t,ql),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ld extends _l{constructor(t,e){super(t,Zl),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class dd extends hl{constructor(t,e,i,s,r){super(t,Ql),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function cd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>cd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=cd(t[i]));return e}var ud=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const pd={none:0,word:1,char:2,character:2,mix:3};var vd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=xd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=xd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=xd(t,"wrapMode");void 0===c&&(c=xd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=pd[c]);var u=xd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=xd(t,"letterSpacing",0),v=xd(t,"hAlign",0),g=xd(t,"vAlign",0),f=xd(t,"justifyPercentage",.25),m=ud({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=wd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wd(t,"maxLines",0);var a=0===i,o=wd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wd(t,"letterSpacing",0),p=wd(t,"rtl",!0),v=wd(t,"hAlign",p?2:0),g=wd(t,"vAlign",0),f=ud({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var B=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ul(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $l(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Jl);return null===i?i=new sd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $d=Phaser.Utils.Objects.GetFastValue;var Jd={};class Kd{constructor(t){this.pools=$d(t,"pools",Jd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ud),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=rc(t,r,e,i,n),a=0;a<=ec&&0!==h;a++){if((r+=h)<0){r=0;break}h=rc(t,r,e,i,n)}return a===ec&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nc(t,e,i),t},sc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rc=function(t,e,i,s,r){var n,h=sc(t,e,r),a=sc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},nc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const hc=Phaser.Utils.Objects.GetValue,ac=Phaser.Utils.Objects.GetValue;class oc extends Oo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ac(e,"background",void 0),r=ac(e,"icon",void 0),n=ac(e,"iconMask",void 0),h=ac(e,"text",void 0),a=ac(e,"action",void 0),o=ac(e,"actionMask",void 0),l=ac(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ac(e,"space.icon",0),top:ac(e,"space.iconTop",0),bottom:ac(e,"space.iconBottom",0),left:ac(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ac(e,"space.icon",0),left:ac(e,"space.iconLeft",0),right:ac(e,"space.iconRight",0),top:ac(e,"space.iconTop",0)});var d=ac(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mo.call(this,r,r,1)),!d){var c=ac(e,"iconSize",void 0);this.setIconSize(ac(e,"iconWidth",c),ac(e,"iconHeight",c))}}if(h){var u=ac(e,"wrapText",!1),p=ac(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ao(t)){case 0:switch("string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,tc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=hc(e,"minWidth",0),s=hc(e,"minHeight",0),r=hc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ic(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ic(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ac(e,"space.text",0),m=ac(e,"expandTextWidth",!1),y=ac(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ac(e,"space.actionTop",0),bottom:ac(e,"space.actionBottom",0),right:ac(e,"space.actionRight",0)}:{left:ac(e,"space.actionLeft",0),right:ac(e,"space.actionRight",0),bottom:ac(e,"space.actionBottom",0)},d=ac(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mo.call(this,a,a,1)),!d)){var b=ac(e,"actionSize");this.setActionSize(ac(e,"actionWidth",b),ac(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var lc=Phaser.Renderer.WebGL.Utils,dc=function(t,e,i,s,r,n){for(var h=lc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},gc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const fc=Phaser.Renderer.Canvas.SetTransform;var mc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=pc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&dc(r,h,e,l,a,o),e.isStroked&&uc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(fc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(bc.prototype,mc);var xc=function(t){return t.x>0&&t.y>0},Sc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Cc=Phaser.Math.DegToRad;var wc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Cu=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject;class Ou extends(Jc(Ic)){constructor(t,e,i,s,r,n,h,a){wu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):wu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):wu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new xu).setName("trackFill")).addShape((new xu).setName("bar")).addShape((new xu).setName("trackStroke")),this.setTrackColor(Cu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Cu(a,"trackStrokeThickness",2),Cu(a,"trackStrokeColor",void 0)),this.setSkewX(Cu(a,"skewX",0)),this.setRTL(Cu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Pu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Su(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Su(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Su(a,0,0,e,i,t)}};Object.assign(Ou.prototype,Pu);var _u=function(t){return null==t||""===t||0===t.length},Tu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(_u(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(_u(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=cd(i),s=cd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Gu(t)?(this.stretchMode.edge=Uu(Vu(t,"edge",0)),this.stretchMode.internal=Uu(Vu(t,"internal",0))):(t=Uu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ju.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const qu=Phaser.Utils.Objects.IsPlainObject,Zu=Phaser.Utils.Objects.GetValue,Qu=Phaser.GameObjects;var tp=void 0,ep=function(t,e){if(tp||(tp={},qe(t).events.once("destroy",(function(){for(var t in tp)tp[t].destroy();tp=void 0}))),!tp.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Qu[e](i)).setOrigin(0),tp[e]=t}return tp[e]};const ip=Phaser.GameObjects.RenderTexture;class sp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(qu(i)?(i=Zu(d=i,"x",0),s=Zu(d,"y",0),r=Zu(d,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(r)?(r=Zu(d=r,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(h)?(h=Zu(d=h,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(a)?(a=Zu(d=a,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Zu(d,"baseFrame",void 0)):qu(o)&&(o=Zu(d=o,"columns",void 0),l=Zu(d,"rows",void 0)),void 0===a&&(a=Zu(d,"frame",void 0)),void 0===o){var c=Zu(d,"leftWidth",void 0),u=Zu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Zu(d,"topHeight",void 0),v=Zu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Zu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Zu(d,"stretchMode",0)),this.setPreserveRatio(Zu(d,"preserveRatio",!0));var g=Zu(d,"maxFixedPartScale",1),f=Zu(d,"maxFixedPartScaleX",g),m=Zu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ku),i}(ip,"rexNinePatch")){}var rp={_drawImage:function(t,e,i,s,r,n){var h=ep(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ep(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(sp.prototype,rp);let np=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Mu(t,e))return t[e];var i=t.parent;return Mu(i,e)?i[e]:void 0}set(t,e,i){return Mu(t,e)?t[e]=i:Mu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const hp=Phaser.Utils.Objects.GetValue;class ap extends sp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=hp(e,"effects",!0);i&&Au(this,i),this.style=new np(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ap.prototype,Dc);const op=["alpha","tint","flipX","flipY"];var lp=function(t,e){if(!e)return t;for(var i=0,s=op.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Be={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Bi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Bi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Bi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Bi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},zs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Bs={};Object.assign(Bs,Ds,zs,As,Ys);const Xs=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Xs(e,"duration.in",200)),this.setTransitOutTime(Xs(e,"duration.out",200)),this.setTransitInCallback(Xs(e,"transitIn")),this.setTransitOutCallback(Xs(e,"transitOut")),this.oneShotMode=Xs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Xs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,Bs);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Dr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},zr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Kr=0,qr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return qe(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const xn="IDLE",Sn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;kn.x=e.x-i.x,kn.y=e.y-i.y}else kn.x=0,kn.y=0;return kn}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,Ge);var kn={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Bn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Bn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Bn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Hn="BEGIN",Nn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Br.call(t,e),jr.call(t,e),Hr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ch[e];else if(oh(e)){var v;e=lh(v=e,"proportion",void 0),i=lh(v,"align",dh),s=lh(v,"padding",0),r=lh(v,"expand",!1),n=lh(v,"key",void 0),h=lh(v,"index",void 0),t.isRexSizer||(a=lh(v,"minWidth",void 0),o=lh(v,"minHeight",void 0)),l=lh(v,"fitRatio",0),d=lh(v,"offsetX",0),c=lh(v,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=kt.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,ph,mh,yh,bh,xh,Sh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class kh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(kh.prototype,Ch);var Eh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},Dh={};const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Bh=Phaser.Utils.String.UUID;var Xh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),zh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Bh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),zh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Wh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Se.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return gh.call(this,t),this}},jh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,Dh.width=a,Dh.height=o,a=(l=Eh(Lh,Dh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Xh,Wh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Hh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Hh.prototype,jh);const Nh=kh.prototype.add,Gh=kh.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Gh.call(this),Nh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Nh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Nh.call(this,t,{index:r,proportion:i,expand:!0})}else Nh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Qh=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Qh.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},xa={add(t,e,i){if(lr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},wa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Ba=Phaser.Utils.Objects.GetValue;class Xa extends ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new aa({parent:this,eventEmitter:Ba(e,"eventEmitter",this),groupName:Ba(e,"groupName",void 0),clickConfig:Ba(e,"click",void 0)}).setButtonsType(e);var s=Ba(e,"background",void 0),r=Ba(e,"buttons",void 0);this.buttonsAlign=Ba(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Xa.prototype,La,Ya,ha,la);var Wa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Ha=Phaser.Display.Align.CENTER;var Na=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Za={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},jo=0,Io=1,Fo=2,Ho=0,No=1,Go=2,Vo=/(?:\r\n|\r|\n)/;const Uo={none:Ho,word:No,char:Go,character:Go,mix:3},$o=Phaser.Renderer.WebGL.Utils;var Jo={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=$o.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ko=Phaser.Display.Color;var qo={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ko);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Zo=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},Qo={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Zo(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const tl=Phaser.Display.Canvas.CanvasPool,el=Phaser.GameObjects.GameObject,il=Phaser.Utils.String.UUID;class sl extends el{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=tl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=il(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){tl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const rl=Phaser.GameObjects.Components;Phaser.Class.mixin(sl,[rl.Alpha,rl.BlendMode,rl.Crop,rl.Depth,rl.Flip,rl.GetBounds,rl.Mask,rl.Origin,rl.Pipeline,rl.PostPipeline,rl.ScrollFactor,rl.Tint,rl.Transform,rl.Visible,Jo,qo,Qo]);var nl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class hl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(hl.prototype,nl);var al={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ol=Phaser.Math.RotateAround;var ll;const dl=Phaser.Geom.Rectangle;var cl,ul=function(t){void 0===cl&&(cl=new dl);var e=t.drawTLX,i=t.drawTLY;return cl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),cl};const pl=Phaser.Math.RotateAround;var vl,gl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),s.x=e,s.y=i,0!==t.rotation&&pl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const fl=Phaser.GameObjects.Components.TransformMatrix;var ml,yl,bl={},xl=function(t,e,i,s,r){var n=gl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=bl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ml&&(ml=new fl,yl=new fl),t.parentContainer?t.getWorldTransformMatrix(ml,yl):ml.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ml.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return xl(t,e,n,h,r)},Cl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ll&&(ll={}),s=ll),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ol(s,0,0,-i.rotation),s}(t,e,this,!0);return ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sl(this.parent,this,t,e,i)}};Object.assign(Cl,al);const wl=Phaser.Math.DegToRad,Ol=Phaser.Math.RadToDeg,Pl=Phaser.Utils.Objects.GetValue;class _l extends hl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ol(this._rotation)}set angle(t){this.rotation=wl(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Pl(t,"width",void 0),i=Pl(t,"height",void 0),s=Pl(t,"scaleX",void 0),r=Pl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_l.prototype,Cl);const Tl=Phaser.Utils.String.Pad;var kl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Tl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},El=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ml=Phaser.Utils.Objects.GetValue;let Rl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ml(t,"x",0),i=Ml(t,"y",0));var s=this.cornerRadius;s.tl=Ll(Ml(t,"tl",void 0),e,i),s.tr=Ll(Ml(t,"tr",void 0),e,i),s.bl=Ll(Ml(t,"bl",void 0),e,i),s.br=Ll(Ml(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Dl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Dl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Dl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Dl(this.cornerRadius.br,t)}};var Ll=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),zl(t),t},Dl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ml(e,"x",0),t.y=Ml(e,"y",0)),zl(t)},zl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Al=Phaser.Math.DegToRad;var Yl=function(t){return!t.hasOwnProperty("convex")||t.convex},Bl=function(t){return t.x>0&&t.y>0},Xl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Xl(t,o,l,o,l,180,270,!1,h):Xl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Xl(t,s-o,l,o,l,270,360,!1,h):Xl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Xl(t,s-o,r-l,o,l,0,90,!1,h):Xl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Xl(t,o,r-l,o,l,90,180,!1,h):Xl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},jl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Wl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Il=Phaser.Utils.Objects.GetValue;class Fl extends _l{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Il(e,"color",null),Il(e,"color2",null),Il(e,"horizontalGradient",!0)),this.setStroke(Il(e,"stroke",null),Il(e,"strokeThickness",2)),this.setCornerRadius(Il(e,"cornerRadius",0),Il(e,"cornerIteration",null))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=kl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,El("color2",t,this),El("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,El("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,El("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){jl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Hl=Phaser.Utils.Objects.GetValue;class Nl extends _l{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Hl(e,"color",null),Hl(e,"color2",null),Hl(e,"horizontalGradient",!0)),this.setStroke(Hl(e,"stroke",null),Hl(e,"strokeThickness",2))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=kl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Hl(t,"color2",null),Hl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Hl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Gl=Phaser.Utils.Objects.GetValue;let Vl=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Gl(t,"bold",!1)),this.setItalic(Gl(t,"italic",!1)),this.setFontSize(Gl(t,"fontSize","16px")),this.setFontFamily(Gl(t,"fontFamily","Courier")),this.setColor(Gl(t,"color","#fff")),this.setStrokeStyle(Gl(t,"stroke",null),Gl(t,"strokeThickness",0)),this.setShadow(Gl(t,"shadowColor",null),Gl(t,"shadowOffsetX",0),Gl(t,"shadowOffsetY",0),Gl(t,"shadowBlur",0)),this.setOffset(Gl(t,"offsetX",0),Gl(t,"offsetY",0)),this.setSpace(Gl(t,"leftSpace",0),Gl(t,"rightSpace",0)),this.setAlign(Gl(t,"align",void 0)),this.setBackgroundColor(Gl(t,"backgroundColor",null)),this.setBackgroundHeight(Gl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Gl(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(El("stroke",t,this),El("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(El("shadowOffsetX",t,this),El("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=kl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=kl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=kl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=kl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ul=Phaser.Utils.Array.Remove,$l=Phaser.Utils.Array.Remove,Jl="text",Kl="image",ql="drawer",Zl="space",Ql="command";var td=function(t){return t.type===Jl&&"\n"===t.text},ed=function(t){return t.type===Jl&&"\f"===t.text},id=function(t){return t.type===Jl};class sd extends _l{constructor(t,e,i){super(t,Jl),this.updateTextFlag=!1,this.style=new Vl(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var rd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const nd=Phaser.Display.Canvas.CanvasPool;var hd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=nd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),nd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ad extends _l{constructor(t,e,i){super(t,Kl),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){hd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class od extends _l{constructor(t,e,i,s){super(t,ql),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class ld extends _l{constructor(t,e){super(t,Zl),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class dd extends hl{constructor(t,e,i,s,r){super(t,Ql),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function cd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>cd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=cd(t[i]));return e}var ud=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const pd={none:0,word:1,char:2,character:2,mix:3};var vd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=xd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=xd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=xd(t,"wrapMode");void 0===c&&(c=xd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=pd[c]);var u=xd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=xd(t,"letterSpacing",0),v=xd(t,"hAlign",0),g=xd(t,"vAlign",0),f=xd(t,"justifyPercentage",.25),m=ud({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=wd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wd(t,"maxLines",0);var a=0===i,o=wd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wd(t,"letterSpacing",0),p=wd(t,"rtl",!0),v=wd(t,"hAlign",p?2:0),g=wd(t,"vAlign",0),f=ud({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var B=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ul(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $l(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Jl);return null===i?i=new sd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $d=Phaser.Utils.Objects.GetFastValue;var Jd={};class Kd{constructor(t){this.pools=$d(t,"pools",Jd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ud),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=rc(t,r,e,i,n),a=0;a<=ec&&0!==h;a++){if((r+=h)<0){r=0;break}h=rc(t,r,e,i,n)}return a===ec&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nc(t,e,i),t},sc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rc=function(t,e,i,s,r){var n,h=sc(t,e,r),a=sc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},nc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const hc=Phaser.Utils.Objects.GetValue,ac=Phaser.Utils.Objects.GetValue;class oc extends Oo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ac(e,"background",void 0),r=ac(e,"icon",void 0),n=ac(e,"iconMask",void 0),h=ac(e,"text",void 0),a=ac(e,"action",void 0),o=ac(e,"actionMask",void 0),l=ac(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ac(e,"space.icon",0),top:ac(e,"space.iconTop",0),bottom:ac(e,"space.iconBottom",0),left:ac(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ac(e,"space.icon",0),left:ac(e,"space.iconLeft",0),right:ac(e,"space.iconRight",0),top:ac(e,"space.iconTop",0)});var d=ac(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mo.call(this,r,r,1)),!d){var c=ac(e,"iconSize",void 0);this.setIconSize(ac(e,"iconWidth",c),ac(e,"iconHeight",c))}}if(h){var u=ac(e,"wrapText",!1),p=ac(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ao(t)){case 0:switch("string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Xo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,tc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=hc(e,"minWidth",0),s=hc(e,"minHeight",0),r=hc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ic(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ic(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ac(e,"space.text",0),m=ac(e,"expandTextWidth",!1),y=ac(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ac(e,"space.actionTop",0),bottom:ac(e,"space.actionBottom",0),right:ac(e,"space.actionRight",0)}:{left:ac(e,"space.actionLeft",0),right:ac(e,"space.actionRight",0),bottom:ac(e,"space.actionBottom",0)},d=ac(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mo.call(this,a,a,1)),!d)){var b=ac(e,"actionSize");this.setActionSize(ac(e,"actionWidth",b),ac(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var lc=Phaser.Renderer.WebGL.Utils,dc=function(t,e,i,s,r,n){for(var h=lc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},gc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const fc=Phaser.Renderer.Canvas.SetTransform;var mc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=pc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&dc(r,h,e,l,a,o),e.isStroked&&uc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(fc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(bc.prototype,mc);var xc=function(t){return t.x>0&&t.y>0},Sc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Cc=Phaser.Math.DegToRad;var wc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Cu=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject;class Ou extends(Jc(Ic)){constructor(t,e,i,s,r,n,h,a){wu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):wu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):wu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new xu).setName("trackFill")).addShape((new xu).setName("bar")).addShape((new xu).setName("trackStroke")),this.setTrackColor(Cu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Cu(a,"trackStrokeThickness",2),Cu(a,"trackStrokeColor",void 0)),this.setSkewX(Cu(a,"skewX",0)),this.setRTL(Cu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Pu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Su(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Su(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Su(a,0,0,e,i,t)}};Object.assign(Ou.prototype,Pu);var _u=function(t){return null==t||""===t||0===t.length},Tu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(_u(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(_u(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=cd(i),s=cd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Gu(t)?(this.stretchMode.edge=Uu(Vu(t,"edge",0)),this.stretchMode.internal=Uu(Vu(t,"internal",0))):(t=Uu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ju.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const qu=Phaser.Utils.Objects.IsPlainObject,Zu=Phaser.Utils.Objects.GetValue,Qu=Phaser.GameObjects;var tp=void 0,ep=function(t,e){if(tp||(tp={},qe(t).events.once("destroy",(function(){for(var t in tp)tp[t].destroy();tp=void 0}))),!tp.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Qu[e](i)).setOrigin(0),tp[e]=t}return tp[e]};const ip=Phaser.GameObjects.RenderTexture;class sp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(qu(i)?(i=Zu(d=i,"x",0),s=Zu(d,"y",0),r=Zu(d,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(r)?(r=Zu(d=r,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(h)?(h=Zu(d=h,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(a)?(a=Zu(d=a,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Zu(d,"baseFrame",void 0)):qu(o)&&(o=Zu(d=o,"columns",void 0),l=Zu(d,"rows",void 0)),void 0===a&&(a=Zu(d,"frame",void 0)),void 0===o){var c=Zu(d,"leftWidth",void 0),u=Zu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Zu(d,"topHeight",void 0),v=Zu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Zu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Zu(d,"stretchMode",0)),this.setPreserveRatio(Zu(d,"preserveRatio",!0));var g=Zu(d,"maxFixedPartScale",1),f=Zu(d,"maxFixedPartScaleX",g),m=Zu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ku),i}(ip,"rexNinePatch")){}var rp={_drawImage:function(t,e,i,s,r,n){var h=ep(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ep(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(sp.prototype,rp);let np=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Mu(t,e))return t[e];var i=t.parent;return Mu(i,e)?i[e]:void 0}set(t,e,i){return Mu(t,e)?t[e]=i:Mu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const hp=Phaser.Utils.Objects.GetValue;class ap extends sp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=hp(e,"effects",!0);i&&Au(this,i),this.style=new np(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ap.prototype,Dc);const op=["alpha","tint","flipX","flipY"];var lp=function(t,e){if(!e)return t;for(var i=0,s=op.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Sp=Phaser.Display.Canvas.CanvasPool;var Cp=function(t){var e=Sp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Sp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Sp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Ho&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Uo[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Op(t,l,d);else{var u=wp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Op(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Op(t,"fill",null);null!==v&&(this.color=kl(v));var g=Op(t,"metrics",!1);return g?this.metrics={ascent:Op(g,"ascent",0),descent:Op(g,"descent",0),fontSize:Op(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Cp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Cp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Op(t,"fontFamily","Courier"),this.fontSize=Op(t,"fontSize","16px"),this.fontStyle=Op(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=kl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=kl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=kl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=kl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=kl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=kl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=kl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Uo[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Op(e,"fontFamily",this.fontFamily),this.fontSize=Op(e,"fontSize",this.fontSize),this.fontStyle=Op(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var _p={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),jl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Tp=Phaser.Utils.Objects.GetValue,kp=jo,Ep=Io;class Mp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Tp(t,"text",""),this.x=Tp(t,"x",0),this.y=Tp(t,"y",0),this.width=Tp(t,"width",0);var e=Tp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Tp(t,"newLineMode",0),this.startIndex=Tp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ep&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==kp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ep&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Rp=Phaser.Utils.Objects.GetFastValue,Lp=jo,Dp=Fo;class zp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Rp(t,"tagToText",Yt),this.tagToTextScope=Rp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ap={};const Yp=Phaser.Geom.Rectangle;var Bp=new Ud;class Wp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Zp(g)){""!==b?h.push(n.getLine(b,x,Gp)):0===S&&r>0&&h.push(n.getLine("",0,Gp)),h.push(...Kp(g,e,$p,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Gp)),b=g,x=f,o=s):(b+=g,x=m),S===C-1&&h.push(n.getLine(b,x,l))}return h},qp=function(t,e){var i;switch(e){case Up:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==tv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new zp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Mg=Phaser.Utils.Objects.GetValue,Rg=Phaser.Math.Distance.Between;class Lg extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Mg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Mg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Mg(t,"enable",!0)),this.holdThreshold=Mg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Mg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return cn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Rg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Dg=Phaser.Utils.Objects.GetValue;class zg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Dg(t,"value",0)),this.setSpeed(Dg(t,"speed",0)),this.setAcceleration(Dg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ag{constructor(){this.value,this.dir,this.movement=new zg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Xg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},jg=Phaser.Utils.Objects.GetValue;class Ig extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=jg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(jg(e,"speed",.1)),this.setEnable(jg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(jg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Fg=Phaser.Utils.Objects.GetValue;var Hg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Fg(s,l,void 0):Fg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new kg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Fg(r,"position",0);"string"==typeof p&&(p=Ng[p]);var v,g,f=Fg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Fg(s,"space.slider",void 0))&&(a?f=0:v=Fg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Fg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Fg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Fg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Fg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Fg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Fg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Fg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Fg(s,"scrollDetectionMode");"string"==typeof b&&(b=Gg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Fg(s,x,!0):Fg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Wg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,C,w,O,P,_=Fg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new Ig(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(C=h?"t":"s",O=`scroll${i}`):(C="t",O="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const Ng={right:0,left:1,bottom:0,top:1},Gg={gameObject:0,rectBounds:1},Vg=Phaser.Utils.Objects.GetValue;var Ug=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Vg(e,"width"),h=Vg(e,"height");n||Vg(e,"child.expandWidth",!0)||(s[1]=0),h||Vg(e,"child.expandHeight",!0)||(r[1]=0);var a=new so(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Qv(i,"child"),r=Qv(s,"gameObject",void 0);if(r){var n=Qv(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Qv(n,"top",0),h.bottom=Qv(n,"bottom",0),a.left=Qv(n,"left",0),a.right=Qv(n,"right",0);break;case 1:h.top=Qv(n,"left",0),h.bottom=Qv(n,"right",0),a.top=Qv(n,"top",0),a.bottom=Qv(n,"bottom",0);break;default:h.top=Qv(n,"top",0),h.bottom=Qv(n,"bottom",0),h.left=Qv(n,"left",0),h.right=Qv(n,"right",0)}e.add(r,{column:1,row:1,align:Qv(s,"align","center"),padding:a,expand:{width:Qv(s,"expandWidth",!0),height:Qv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hg(t,a,"y",e);break;case 1:Hg(t,a,"x",e);break;default:Hg(t,a,"y",e),Hg(t,a,"x",e)}return a},$g=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Jg=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Kg=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(sf.call(this,-this.textOY)),0),e=rf.call(this,t)+this.textOY,i=nf.call(this,t);return function(t,e){switch(Ao(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,hf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,We.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,of.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,hf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const df=Phaser.Utils.Objects.IsPlainObject,cf=Phaser.Utils.Objects.GetValue,uf=Phaser.Display.Align.TOP_LEFT;class pf extends eh{constructor(t,e,i,s,r,n){df(e)?(e=cf(n=e,"x",0),i=cf(n,"y",0),s=cf(n,"width",void 0),r=cf(n,"height",void 0)):df(s)&&(s=cf(n=s,"width",void 0),r=cf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=cf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(cf(n,"clampTextOY",!0)),this.alwaysScrollable=cf(n,"alwaysScrollable",!1);var h=cf(n,"background",void 0),a=cf(n,"text",void 0);void 0===a&&(a=vf(t)),this.textCropEnable=cf(n,"textCrop",!!a.setCrop);var o=cf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=uf,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=Ao(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Mo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(sf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=rf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var vf=function(t){return t.add.text(0,0,"")};Object.assign(pf.prototype,lf);var gf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ff={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const mf=Phaser.Utils.Objects.GetValue;class yf extends tf{constructor(t,e){void 0===e&&(e={});var i=mf(e,"text",void 0),s=mf(e,"textWidth",void 0),r=mf(e,"textHeight",void 0),n=mf(e,"textCrop",!!i.setCrop),h=mf(e,"textMask",!n),a=mf(e,"content",""),o=new pf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:mf(e,"clampChildOY",!1),alwaysScrollable:mf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=mf(e,"space",void 0);l&&(l.child=mf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(yf.prototype,gf,ff);const bf=Phaser.Utils.Objects.GetValue;var xf=function(t,e,i){e=e?cd(e):{};var s=bf(i,"background",dp),r=bf(i,"text",Sf),n=bf(i,"track",dp),h=bf(i,"thumb",dp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new yf(t,e);return t.add.existing(o),o},Sf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Kv(t,e);break;case"bbcodetext":case"bbcode":s=new Vv(t,0,0,"",e);break;case"label":s=new Of(t,e);break;case"textarea":s=xf(t,e);break;default:s=new pp(t,e)}return lp(s,e),t.add.existing(s),s},Cf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new ap(t,e):new Xu(t,e);break;case"roundRectangle":s=new zc(t,e);break;default:s=new Hu(t,e)}return lp(s,e),t.add.existing(s),s};const wf=Phaser.Utils.Objects.GetValue;class Of extends oc{constructor(t,e,i){e=function(t,e,i){e=e?cd(e):{};var s=wf(i,"background",dp),r=wf(i,"text",Sf),n=wf(i,"icon",Cf),h=wf(i,"action",Cf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Pf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Pf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Pf(this.getChildren(),"setDisableState",t),this}}var Pf=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Ho&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Uo[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Op(t,l,d);else{var u=wp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Op(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Op(t,"fill",null);null!==v&&(this.color=kl(v));var g=Op(t,"metrics",!1);return g?this.metrics={ascent:Op(g,"ascent",0),descent:Op(g,"descent",0),fontSize:Op(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Cp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Cp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Op(t,"fontFamily","Courier"),this.fontSize=Op(t,"fontSize","16px"),this.fontStyle=Op(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=kl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=kl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=kl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=kl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=kl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=kl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=kl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=kl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Uo[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Op(e,"fontFamily",this.fontFamily),this.fontSize=Op(e,"fontSize",this.fontSize),this.fontStyle=Op(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var _p={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),jl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Tp=Phaser.Utils.Objects.GetValue,kp=jo,Ep=Io;class Mp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Tp(t,"text",""),this.x=Tp(t,"x",0),this.y=Tp(t,"y",0),this.width=Tp(t,"width",0);var e=Tp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Tp(t,"newLineMode",0),this.startIndex=Tp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ep&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==kp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ep&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Rp=Phaser.Utils.Objects.GetFastValue,Lp=jo,Dp=Fo;class zp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Rp(t,"tagToText",Yt),this.tagToTextScope=Rp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ap={};const Yp=Phaser.Geom.Rectangle;var Bp=new Ud;class Xp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Zp(g)){""!==b?h.push(n.getLine(b,x,Gp)):0===S&&r>0&&h.push(n.getLine("",0,Gp)),h.push(...Kp(g,e,$p,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Gp)),b=g,x=f,o=s):(b+=g,x=m),S===C-1&&h.push(n.getLine(b,x,l))}return h},qp=function(t,e){var i;switch(e){case Up:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==tv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new zp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Mg=Phaser.Utils.Objects.GetValue,Rg=Phaser.Math.Distance.Between;class Lg extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Mg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Mg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Mg(t,"enable",!0)),this.holdThreshold=Mg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Mg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return cn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Rg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Dg=Phaser.Utils.Objects.GetValue;class zg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Dg(t,"value",0)),this.setSpeed(Dg(t,"speed",0)),this.setAcceleration(Dg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ag{constructor(){this.value,this.dir,this.movement=new zg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Wg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},jg=Phaser.Utils.Objects.GetValue;class Ig extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=jg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(jg(e,"speed",.1)),this.setEnable(jg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(jg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Fg=Phaser.Utils.Objects.GetValue;var Hg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Fg(s,l,void 0):Fg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new kg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Fg(r,"position",0);"string"==typeof p&&(p=Ng[p]);var v,g,f=Fg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Fg(s,"space.slider",void 0))&&(a?f=0:v=Fg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Fg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Fg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Fg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Fg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Fg(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Fg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Fg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Fg(s,"scrollDetectionMode");"string"==typeof b&&(b=Gg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Fg(s,x,!0):Fg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Xg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,C,w,O,P,_=Fg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new Ig(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(C=h?"t":"s",O=`scroll${i}`):(C="t",O="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const Ng={right:0,left:1,bottom:0,top:1},Gg={gameObject:0,rectBounds:1},Vg=Phaser.Utils.Objects.GetValue;var Ug=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Vg(e,"width"),h=Vg(e,"height");n||Vg(e,"child.expandWidth",!0)||(s[1]=0),h||Vg(e,"child.expandHeight",!0)||(r[1]=0);var a=new so(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Qv(i,"child"),r=Qv(s,"gameObject",void 0);if(r){var n=Qv(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Qv(n,"top",0),h.bottom=Qv(n,"bottom",0),a.left=Qv(n,"left",0),a.right=Qv(n,"right",0);break;case 1:h.top=Qv(n,"left",0),h.bottom=Qv(n,"right",0),a.top=Qv(n,"top",0),a.bottom=Qv(n,"bottom",0);break;default:h.top=Qv(n,"top",0),h.bottom=Qv(n,"bottom",0),h.left=Qv(n,"left",0),h.right=Qv(n,"right",0)}e.add(r,{column:1,row:1,align:Qv(s,"align","center"),padding:a,expand:{width:Qv(s,"expandWidth",!0),height:Qv(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hg(t,a,"y",e);break;case 1:Hg(t,a,"x",e);break;default:Hg(t,a,"y",e),Hg(t,a,"x",e)}return a},$g=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Jg=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Kg=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(sf.call(this,-this.textOY)),0),e=rf.call(this,t)+this.textOY,i=nf.call(this,t);return function(t,e){switch(Ao(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,hf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Xe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,of.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,hf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const df=Phaser.Utils.Objects.IsPlainObject,cf=Phaser.Utils.Objects.GetValue,uf=Phaser.Display.Align.TOP_LEFT;class pf extends eh{constructor(t,e,i,s,r,n){df(e)?(e=cf(n=e,"x",0),i=cf(n,"y",0),s=cf(n,"width",void 0),r=cf(n,"height",void 0)):df(s)&&(s=cf(n=s,"width",void 0),r=cf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=cf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(cf(n,"clampTextOY",!0)),this.alwaysScrollable=cf(n,"alwaysScrollable",!1);var h=cf(n,"background",void 0),a=cf(n,"text",void 0);void 0===a&&(a=vf(t)),this.textCropEnable=cf(n,"textCrop",!!a.setCrop);var o=cf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=uf,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=Ao(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Mo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(sf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=rf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var vf=function(t){return t.add.text(0,0,"")};Object.assign(pf.prototype,lf);var gf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ff={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const mf=Phaser.Utils.Objects.GetValue;class yf extends tf{constructor(t,e){void 0===e&&(e={});var i=mf(e,"text",void 0),s=mf(e,"textWidth",void 0),r=mf(e,"textHeight",void 0),n=mf(e,"textCrop",!!i.setCrop),h=mf(e,"textMask",!n),a=mf(e,"content",""),o=new pf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:mf(e,"clampChildOY",!1),alwaysScrollable:mf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=mf(e,"space",void 0);l&&(l.child=mf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(yf.prototype,gf,ff);const bf=Phaser.Utils.Objects.GetValue;var xf=function(t,e,i){e=e?cd(e):{};var s=bf(i,"background",dp),r=bf(i,"text",Sf),n=bf(i,"track",dp),h=bf(i,"thumb",dp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new yf(t,e);return t.add.existing(o),o},Sf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Kv(t,e);break;case"bbcodetext":case"bbcode":s=new Vv(t,0,0,"",e);break;case"label":s=new Of(t,e);break;case"textarea":s=xf(t,e);break;default:s=new pp(t,e)}return lp(s,e),t.add.existing(s),s},Cf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new ap(t,e):new Wu(t,e);break;case"roundRectangle":s=new zc(t,e);break;default:s=new Hu(t,e)}return lp(s,e),t.add.existing(s),s};const wf=Phaser.Utils.Objects.GetValue;class Of extends oc{constructor(t,e,i){e=function(t,e,i){e=e?cd(e):{};var s=wf(i,"background",dp),r=wf(i,"text",Sf),n=wf(i,"icon",Cf),h=wf(i,"action",Cf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Pf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Pf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Pf(this.getChildren(),"setDisableState",t),this}}var Pf=function(t,e,i){for(var s=0,r=t.length;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -13187,6 +13203,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexdialog.min.js b/dist/rexdialog.min.js index 21b0891ac0..200ef2774a 100644 --- a/dist/rexdialog.min.js +++ b/dist/rexdialog.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},z={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const we=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},_e={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var h={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new Ei(t,o):n.resetFromJSON(o),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var h,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},a={x:i};break;case 1:case"y":h={y:t.scaleX},a={y:i};break;default:h=t.scaleX,a=i}var l={mode:2,start:h,end:a,duration:e/2,ease:n,repeat:s};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,zi),Mi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,Di=Phaser.Math.Linear;class Ai extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Di(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,o):s.resetFromJSON(o),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Fi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Fi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const os=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Bs=Phaser.Utils.Objects.GetValue;class Is extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,As);var Ys=function(t){if(t.parentContainer)return Ys(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ys(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ys(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,h=r/2,a=n/2,l=r*o,d=n*o;e.x===h&&e.y===a||e.setPosition(h,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class js extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class Fs extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends js{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,a=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,h=n.pointers,a=0;a0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const Er=Phaser.Utils.Objects.GetValue;class wr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case On:this.tracerState=Tn,this.onDrag1End();break;case _n:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,Fe);var Pn={};const Tn=0,On=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Bn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,h=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Bn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Bn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const Xn="IDLE",Nn="BEGIN",jn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ar.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",he),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(o=ne(a,"align","left-top"))&&(o=Dt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=o)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=o+1),r};const no=Phaser.Utils.Objects.IsPlainObject,oo=Phaser.Utils.Objects.GetValue,ho=Phaser.Display.Align.CENTER,ao={min:0,full:-1};var lo=function(t,e,i,s,r,n,o,h,a,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ao[e];else if(no(e)){var u;e=oo(u=e,"proportion",void 0),i=oo(u,"align",ho),s=oo(u,"padding",0),r=oo(u,"expand",!1),n=oo(u,"key",void 0),o=oo(u,"index",void 0),t.isRexSizer||(h=oo(u,"minWidth",void 0),a=oo(u,"minHeight",void 0)),l=oo(u,"fitRatio",0)}return"string"==typeof i&&(i=Dt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ho),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},co={add:lo,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lo.call(this,new so(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,h){return no(i)&&(i.index=t),lo.call(this,e,i,s,r,n,o,t,h),this},insertAtPosition(t,e,i,s,r,n,o,h,a){var l=ro.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,h,a),this}};const uo=Ot.prototype.clear;var po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uo.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},fo={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Dt[e]),this.getSizerConfig(t).align=e,this}},mo={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yo={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Co={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,o+=n)))}return a?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,h,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eo.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eo.call(this,void 0,t),De.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Co,co,go,fo,mo,yo,bo);var So=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eo=function(t){return"string"==typeof t&&(t=xo[t]),t};const wo=Phaser.Utils.Objects.IsPlainObject,Po=Phaser.Utils.Objects.GetValue;class To extends Kn{constructor(t,e,i,s,r,n,o){wo(e)?(e=Po(o=e,"x",0),i=Po(o,"y",0),s=Po(o,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):wo(s)?(s=Po(o=s,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):wo(n)&&(n=Po(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Po(o,"space.item",0)),this.setStartChildIndex(Po(o,"startChildIndex",0)),this.setRTL(Po(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eo(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=So.call(this)),this._childrenProportion}}Object.assign(To.prototype,Co);var Oo=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=_o[i])}void 0===s?s={}:!0===s&&(s=ko);var n=e.width/t.width,o=e.height/t.height,h=i?Math.max(n,o):Math.min(n,o);return s.width=t.width*h,s.height=t.height*h,s};const _o={fit:0,FIT:0,envelop:1,ENVELOP:1};var ko={},zo={},Mo={};const Ro=Phaser.Utils.Objects.IsPlainObject,Lo=Phaser.Utils.Objects.GetValue,Do=Phaser.Display.Align.CENTER,Ao=Phaser.Utils.String.UUID;var Bo={add:function(t,e,i,s,r,n,o,h,a,l){ue.call(this,t),Ro(e)&&(e=Lo(d=e,"key",void 0),i=Lo(d,"align",Do),s=Lo(d,"padding",0),r=Lo(d,"expand",!0),t.isRexSizer||(n=Lo(d,"minWidth",t._minWidth),o=Lo(d,"minHeight",t._minHeighted)),h=Lo(d,"offsetX",0),a=Lo(d,"offsetY",0),l=Lo(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Ao()),"string"==typeof i&&(i=Dt[i]),void 0===i&&(i=Do),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===o&&(o=t._minHeight)),void 0===h&&(h=0),void 0===a&&(a=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===o&&(o=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Ro(r)?(d.expandWidth=Lo(r,"width",!1),d.expandHeight=Lo(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===o?tt(t):o)),d.alignOffsetX=h,d.alignOffsetY=a,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Io={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),be.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return po.call(this,t),this}},Yo={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var o in r)t=r[o],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var o in r)t=r[o],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,o,h,a,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ur.call(this,t),h=this.getExpandedChildWidth(t),a=this.getExpandedChildHeight(t),e.aspectRatio>0&&(zo.width=e.aspectRatio,zo.height=1,Mo.width=h,Mo.height=a,h=(l=Oo(zo,Mo,"FIT",!0)).width,a=l.height),t.isRexSizer?(t.runLayout(this,h,a),Qn(t,this)):Xe(t,h,a),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,o=p-(i.top+i.bottom)*this.scaleY,pr.call(this,t,s,r,n,o,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Yo,Bo,Io);const Xo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue;class jo extends Kn{constructor(t,e,i,s,r,n){Xo(e)?(e=No(n=e,"x",0),i=No(n,"y",0),s=No(n,"width",void 0),r=No(n,"height",void 0)):Xo(s)&&(s=No(n=s,"width",void 0),r=No(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(jo.prototype,Yo);const Wo=To.prototype.add,Fo=To.prototype.addSpace;var Go=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Fo.call(this),Wo.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Fo.call(this),this.hasTailSpace=s}else Wo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Wo.call(this,t,{index:r,proportion:i,expand:!0})}else Wo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ho={addButton(t){if(hr(t))for(var e=t,i=0,s=e.length;i=0;i--)Jo.call(this,e[i],t);return this}},qo=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Zo=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,qo.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Ko={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Zo.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sh.height/2)){r>(a=uh(h.left,h.centerY,t,e))&&(r=a,s=n);var a,l=i[n+1];l&&l.y===h.y||r>(a=uh(h.right,h.centerY,t,e))&&(r=a,s=n+1)}}return s};const vh=Phaser.Utils.Objects.IsPlainObject,gh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER;var mh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ue.call(this,t),vh(e)&&(e=gh(r=e,"padding",0),i=gh(r,"key",void 0),s=gh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=fh,r.padding=de(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},yh={add(t,e,i){if(hr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},Sh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&_h.addNewLine(this)}else for(n=0,o=t.length;n=0;i--)Lh.call(this,e[i],t);return this}};const Ah=Phaser.Utils.Objects.GetValue;class Bh extends Th{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new nh({parent:this,eventEmitter:Ah(e,"eventEmitter",this),groupName:Ah(e,"groupName",void 0),clickConfig:Ah(e,"click",void 0)}).setButtonsType(e);var s=Ah(e,"background",void 0),r=Ah(e,"buttons",void 0);this.buttonsAlign=Ah(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Bh.prototype,zh,Dh,rh,hh);var Ih=function(){return Array.prototype.reduce.call(arguments,Yh,0)},Yh=function(t,e){return t+e};const Xh=Phaser.Utils.Objects.IsPlainObject,Nh=Phaser.Utils.Objects.GetValue,jh=Phaser.Display.Align.CENTER;var Wh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Gh(this.sizerChildren,null),po.call(this,t),this}},Uh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Gh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},qh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Gh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Gh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Kh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Qh=Phaser.Utils.Objects.IsPlainObject,ta=Phaser.Utils.Objects.GetValue;class ea extends Kn{constructor(t,e,i,s,r,n,o,h,a,l){Qh(e)?(e=ta(l=e,"x",0),i=ta(l,"y",0),s=ta(l,"width",void 0),r=ta(l,"height",void 0),n=ta(l,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(s)?(s=ta(l=s,"width",void 0),r=ta(l,"height",void 0),n=ta(l,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(n)?(n=ta(l=n,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(h)&&(h=ta(l=h,"columnProportions",0),a=ta(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(ta(l,"createCellContainerCallback")),this.setIndentLeft(ta(l,"space.indentLeftOdd",0),ta(l,"space.indentLeftEven",0)),this.setIndentTop(ta(l,"space.indentTopOdd",0),ta(l,"space.indentTopEven",0)),this.resetGrid(n,o,h,a,ta(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Zh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Kh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ea.prototype,qh);const ia=ea.prototype.add;var sa={addButton(t,e,i){return ia.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oa.call(this,e[i],t);return this}};const aa=Phaser.Utils.Objects.GetValue;class la extends ea{constructor(t,e){void 0===e&&(e={});var i=aa(e,"row",0),s=aa(e,"column",e.col||0),r=aa(e,"createCellContainerCallback"),n=aa(e,"buttons",void 0),o=aa(e,"expand",!0),h=o?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var a=0,l=n.length;a=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},z={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const we=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},_e={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var h={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new Ei(t,o):n.resetFromJSON(o),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var h,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},a={x:i};break;case 1:case"y":h={y:t.scaleX},a={y:i};break;default:h=t.scaleX,a=i}var l={mode:2,start:h,end:a,duration:e/2,ease:n,repeat:s};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,zi),Mi.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,Di=Phaser.Math.Linear;class Ai extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Di(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,o):s.resetFromJSON(o),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Fi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Fi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const os=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Bs=Phaser.Utils.Objects.GetValue;class Is extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,As);var Ys=function(t){if(t.parentContainer)return Ys(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ys(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ys(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,h=r/2,a=n/2,l=r*o,d=n*o;e.x===h&&e.y===a||e.setPosition(h,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class js extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class Fs extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends js{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,a=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,h=n.pointers,a=0;a0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const Er=Phaser.Utils.Objects.GetValue;class wr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case On:this.tracerState=Tn,this.onDrag1End();break;case _n:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,Fe);var Pn={};const Tn=0,On=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Bn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,h=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Bn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Bn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const Xn="IDLE",Nn="BEGIN",jn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ar.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",he),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(o=ne(a,"align","left-top"))&&(o=Dt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=o)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=o+1),r};const no=Phaser.Utils.Objects.IsPlainObject,oo=Phaser.Utils.Objects.GetValue,ho=Phaser.Display.Align.CENTER,ao={min:0,full:-1};var lo=function(t,e,i,s,r,n,o,h,a,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ao[e];else if(no(e)){var v;e=oo(v=e,"proportion",void 0),i=oo(v,"align",ho),s=oo(v,"padding",0),r=oo(v,"expand",!1),n=oo(v,"key",void 0),o=oo(v,"index",void 0),t.isRexSizer||(h=oo(v,"minWidth",void 0),a=oo(v,"minHeight",void 0)),l=oo(v,"fitRatio",0),d=oo(v,"offsetX",0),c=oo(v,"offsetY",0)}return"string"==typeof i&&(i=Dt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ho),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},co={add:lo,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lo.call(this,new so(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,h){return no(i)&&(i.index=t),lo.call(this,e,i,s,r,n,o,t,h),this},insertAtPosition(t,e,i,s,r,n,o,h,a){var l=ro.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,h,a),this}};const uo=Ot.prototype.clear;var po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uo.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},fo={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Dt[e]),this.getSizerConfig(t).align=e,this}},mo={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yo={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Co={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,o+=n)))}return a?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,h,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eo.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eo.call(this,void 0,t),De.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Co,co,go,fo,mo,yo,bo);var So=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eo=function(t){return"string"==typeof t&&(t=xo[t]),t};const wo=Phaser.Utils.Objects.IsPlainObject,Po=Phaser.Utils.Objects.GetValue;class To extends Kn{constructor(t,e,i,s,r,n,o){wo(e)?(e=Po(o=e,"x",0),i=Po(o,"y",0),s=Po(o,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):wo(s)?(s=Po(o=s,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):wo(n)&&(n=Po(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Po(o,"space.item",0)),this.setStartChildIndex(Po(o,"startChildIndex",0)),this.setRTL(Po(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eo(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=So.call(this)),this._childrenProportion}}Object.assign(To.prototype,Co);var Oo=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=_o[i])}void 0===s?s={}:!0===s&&(s=ko);var n=e.width/t.width,o=e.height/t.height,h=i?Math.max(n,o):Math.min(n,o);return s.width=t.width*h,s.height=t.height*h,s};const _o={fit:0,FIT:0,envelop:1,ENVELOP:1};var ko={},zo={},Mo={};const Ro=Phaser.Utils.Objects.IsPlainObject,Lo=Phaser.Utils.Objects.GetValue,Do=Phaser.Display.Align.CENTER,Ao=Phaser.Utils.String.UUID;var Bo={add:function(t,e,i,s,r,n,o,h,a,l){ue.call(this,t),Ro(e)&&(e=Lo(d=e,"key",void 0),i=Lo(d,"align",Do),s=Lo(d,"padding",0),r=Lo(d,"expand",!0),t.isRexSizer||(n=Lo(d,"minWidth",t._minWidth),o=Lo(d,"minHeight",t._minHeighted)),h=Lo(d,"offsetX",0),a=Lo(d,"offsetY",0),l=Lo(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Ao()),"string"==typeof i&&(i=Dt[i]),void 0===i&&(i=Do),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===o&&(o=t._minHeight)),void 0===h&&(h=0),void 0===a&&(a=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===o&&(o=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Ro(r)?(d.expandWidth=Lo(r,"width",!1),d.expandHeight=Lo(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===o?tt(t):o)),d.alignOffsetX=h,d.alignOffsetY=a,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Io={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),be.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return po.call(this,t),this}},Yo={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var o in r)t=r[o],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var o in r)t=r[o],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,o,h,a,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ur.call(this,t),h=this.getExpandedChildWidth(t),a=this.getExpandedChildHeight(t),e.aspectRatio>0&&(zo.width=e.aspectRatio,zo.height=1,Mo.width=h,Mo.height=a,h=(l=Oo(zo,Mo,"FIT",!0)).width,a=l.height),t.isRexSizer?(t.runLayout(this,h,a),Qn(t,this)):Xe(t,h,a),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,o=p-(i.top+i.bottom)*this.scaleY,pr.call(this,t,s,r,n,o,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Yo,Bo,Io);const Xo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue;class jo extends Kn{constructor(t,e,i,s,r,n){Xo(e)?(e=No(n=e,"x",0),i=No(n,"y",0),s=No(n,"width",void 0),r=No(n,"height",void 0)):Xo(s)&&(s=No(n=s,"width",void 0),r=No(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(jo.prototype,Yo);const Wo=To.prototype.add,Fo=To.prototype.addSpace;var Go=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Fo.call(this),Wo.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Fo.call(this),this.hasTailSpace=s}else Wo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Wo.call(this,t,{index:r,proportion:i,expand:!0})}else Wo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ho={addButton(t){if(hr(t))for(var e=t,i=0,s=e.length;i=0;i--)Jo.call(this,e[i],t);return this}},qo=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Zo=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,qo.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Ko={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Zo.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sh.height/2)){r>(a=uh(h.left,h.centerY,t,e))&&(r=a,s=n);var a,l=i[n+1];l&&l.y===h.y||r>(a=uh(h.right,h.centerY,t,e))&&(r=a,s=n+1)}}return s};const vh=Phaser.Utils.Objects.IsPlainObject,gh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER;var mh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ue.call(this,t),vh(e)&&(e=gh(r=e,"padding",0),i=gh(r,"key",void 0),s=gh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=fh,r.padding=de(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},yh={add(t,e,i){if(hr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},Sh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&_h.addNewLine(this)}else for(n=0,o=t.length;n=0;i--)Lh.call(this,e[i],t);return this}};const Ah=Phaser.Utils.Objects.GetValue;class Bh extends Th{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new nh({parent:this,eventEmitter:Ah(e,"eventEmitter",this),groupName:Ah(e,"groupName",void 0),clickConfig:Ah(e,"click",void 0)}).setButtonsType(e);var s=Ah(e,"background",void 0),r=Ah(e,"buttons",void 0);this.buttonsAlign=Ah(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Bh.prototype,zh,Dh,rh,hh);var Ih=function(){return Array.prototype.reduce.call(arguments,Yh,0)},Yh=function(t,e){return t+e};const Xh=Phaser.Utils.Objects.IsPlainObject,Nh=Phaser.Utils.Objects.GetValue,jh=Phaser.Display.Align.CENTER;var Wh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Gh(this.sizerChildren,null),po.call(this,t),this}},Uh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Gh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},qh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Gh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Gh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Kh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Qh=Phaser.Utils.Objects.IsPlainObject,ta=Phaser.Utils.Objects.GetValue;class ea extends Kn{constructor(t,e,i,s,r,n,o,h,a,l){Qh(e)?(e=ta(l=e,"x",0),i=ta(l,"y",0),s=ta(l,"width",void 0),r=ta(l,"height",void 0),n=ta(l,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(s)?(s=ta(l=s,"width",void 0),r=ta(l,"height",void 0),n=ta(l,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(n)?(n=ta(l=n,"column",l.col||0),o=ta(l,"row",0),h=ta(l,"columnProportions",0),a=ta(l,"rowProportions",0)):Qh(h)&&(h=ta(l=h,"columnProportions",0),a=ta(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(ta(l,"createCellContainerCallback")),this.setIndentLeft(ta(l,"space.indentLeftOdd",0),ta(l,"space.indentLeftEven",0)),this.setIndentTop(ta(l,"space.indentTopOdd",0),ta(l,"space.indentTopEven",0)),this.resetGrid(n,o,h,a,ta(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Zh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Kh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ea.prototype,qh);const ia=ea.prototype.add;var sa={addButton(t,e,i){return ia.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oa.call(this,e[i],t);return this}};const aa=Phaser.Utils.Objects.GetValue;class la extends ea{constructor(t,e){void 0===e&&(e={});var i=aa(e,"row",0),s=aa(e,"column",e.col||0),r=aa(e,"createCellContainerCallback"),n=aa(e,"buttons",void 0),o=aa(e,"expand",!0),h=o?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var a=0,l=n.length;a= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexdropdownlist.min.js b/dist/rexdropdownlist.min.js index 788e8ba204..4b234f44ce 100644 --- a/dist/rexdropdownlist.min.js +++ b/dist/rexdropdownlist.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},De={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let ki=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const qi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Xs,Ys,zs,As);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;class Vs extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Gs=Phaser.Utils.Objects.GetValue;class Ns extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",Ks)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=qs.popUp;break;case ir.fadeIn:t=qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=qs.scaleDown;break;case ir.fadeOut:t=qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Cr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Pr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const kr=Phaser.Utils.Objects.GetValue;class _r extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class Rr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Xr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Yr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const Kr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class Cn extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=xn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,gn);const xn="IDLE",Sn="BEGIN",wn="RECOGNIZED",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Pn(e,"inputConfig",void 0)),this.setEventEmitter(Pn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Pn(t,"enable",!0)),this.bounds=Pn(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Dn:this.tracerState=Mn,this.onDrag1End();break;case Rn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ne);var En={};const Mn=0,Dn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Xn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Xn(t,e,i,s),t.rotation+=s,t},zn={};const An=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Vr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),Kn.call(t,e),t},th={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Ch={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,vh,yh,bh,Ch,xh,Sh);var Ph=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ph.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Dh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Rh extends Eh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Mh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Mh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Rh.prototype,Dh);var Lh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Xh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Yh=Phaser.GameObjects.Graphics;class zh extends Yh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Xh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Lh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Lh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Wh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Bh=Phaser.GameObjects.Text;var jh=function(t){return t instanceof Bh};const Ih=Phaser.GameObjects.BitmapText;var Fh=function(t){return t instanceof Ih},Hh=/^[\x00-\x7F]+$/,Vh=function(t){return Hh.test(t)},Gh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Uh=2;const $h={none:0,word:1,char:Uh,character:Uh,mix:3};var Jh=function(t,e){var i=function(t){return Fh(t)?2:jh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Gh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e}};const qh=Phaser.Renderer.WebGL.Utils;var Kh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Zh=Phaser.Display.Color;var Qh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Zh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ta={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ea=Phaser.Display.Canvas.CanvasPool,ia=Phaser.GameObjects.GameObject,sa=Phaser.Utils.String.UUID;class ra extends ia{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ea.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=sa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ea.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const na=Phaser.GameObjects.Components;Phaser.Class.mixin(ra,[na.Alpha,na.BlendMode,na.Crop,na.Depth,na.Flip,na.GetBounds,na.Mask,na.Origin,na.Pipeline,na.PostPipeline,na.ScrollFactor,na.Tint,na.Transform,na.Visible,Kh,Qh,ta]);var ha={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class aa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(aa.prototype,ha);var oa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const la=Phaser.Math.RotateAround;var da;const ca=Phaser.Geom.Rectangle;var ua,pa=function(t){void 0===ua&&(ua=new ca);var e=t.drawTLX,i=t.drawTLY;return ua.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ua};const va=Phaser.Math.RotateAround;var ga,fa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=e,s.y=i,0!==t.rotation&&va(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ma=Phaser.GameObjects.Components.TransformMatrix;var ya,ba,Ca={},xa=function(t,e,i,s,r){var n=fa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ya&&(ya=new ma,ba=new ma),t.parentContainer?t.getWorldTransformMatrix(ya,ba):ya.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ya.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return xa(t,e,n,h,r)},wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===da&&(da={}),s=da),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&la(s,0,0,-i.rotation),s}(t,e,this,!0);return pa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sa(this.parent,this,t,e,i)}};Object.assign(wa,oa);const Pa=Phaser.Math.DegToRad,Oa=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class _a extends aa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Oa(this._rotation)}set angle(t){this.rotation=Pa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_a.prototype,wa);const Ta=Phaser.Utils.String.Pad;var Ea=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ma=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Ra=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=La(Da(t,"tl",void 0),e,i),s.tr=La(Da(t,"tr",void 0),e,i),s.bl=La(Da(t,"bl",void 0),e,i),s.br=La(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var La=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Aa=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Ba=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,l,o,l,180,270,!1,h):Ba(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,l,o,l,270,360,!1,h):Ba(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,r-l,o,l,0,90,!1,h):Ba(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,r-l,o,l,90,180,!1,h):Ba(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Ia=Phaser.Utils.Objects.GetValue;class Fa extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ma("color2",t,this),Ma("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ma("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ma("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Va extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ga=Phaser.Utils.Objects.GetValue;class Na{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ga(t,"bold",!1)),this.setItalic(Ga(t,"italic",!1)),this.setFontSize(Ga(t,"fontSize","16px")),this.setFontFamily(Ga(t,"fontFamily","Courier")),this.setColor(Ga(t,"color","#fff")),this.setStrokeStyle(Ga(t,"stroke",null),Ga(t,"strokeThickness",0)),this.setShadow(Ga(t,"shadowColor",null),Ga(t,"shadowOffsetX",0),Ga(t,"shadowOffsetY",0),Ga(t,"shadowBlur",0)),this.setOffset(Ga(t,"offsetX",0),Ga(t,"offsetY",0)),this.setSpace(Ga(t,"leftSpace",0),Ga(t,"rightSpace",0)),this.setAlign(Ga(t,"align",void 0)),this.setBackgroundColor(Ga(t,"backgroundColor",null)),this.setBackgroundHeight(Ga(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ga(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ma("stroke",t,this),Ma("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ma("shadowOffsetX",t,this),Ma("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Na(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ea(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ea(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ea(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ea(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends _a{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ho extends _a{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ao extends _a{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class oo extends _a{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class lo extends aa{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>co(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=co(t[i]));return e}var uo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const po={none:0,word:1,char:2,character:2,mix:3};var vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Co(t,"wrapMode");void 0===c&&(c=Co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=po[c]);var u=Co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Co(t,"letterSpacing",0),v=Co(t,"hAlign",0),g=Co(t,"vAlign",0),f=Co(t,"justifyPercentage",.25),m=uo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wo(t,"maxLines",0);var a=0===i,o=wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wo(t,"letterSpacing",0),p=wo(t,"rtl",!0),v=wo(t,"hAlign",p?2:0),g=wo(t,"vAlign",0),f=uo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=rl(t,r,e,i,n),a=0;a<=el&&0!==h;a++){if((r+=h)<0){r=0;break}h=rl(t,r,e,i,n)}return a===el&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nl(t,e,i),t},sl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rl=function(t,e,i,s,r){var n,h=sl(t,e,r),a=sl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},nl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const hl=Phaser.Utils.Objects.GetValue,al=Phaser.Utils.Objects.GetValue;class ol extends Rh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=al(e,"background",void 0),r=al(e,"icon",void 0),n=al(e,"iconMask",void 0),h=al(e,"text",void 0),a=al(e,"action",void 0),o=al(e,"actionMask",void 0),l=al(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:al(e,"space.icon",0),top:al(e,"space.iconTop",0),bottom:al(e,"space.iconBottom",0),left:al(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:al(e,"space.icon",0),left:al(e,"space.iconLeft",0),right:al(e,"space.iconRight",0),top:al(e,"space.iconTop",0)});var d=al(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wh.call(this,r,r,1)),!d){var c=al(e,"iconSize",void 0);this.setIconSize(al(e,"iconWidth",c),al(e,"iconHeight",c))}}if(h){var u=al(e,"wrapText",!1),p=al(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Jh(h,u),e.expandTextWidth=!0,tl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=hl(e,"minWidth",0),s=hl(e,"minHeight",0),r=hl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return il(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),il(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=al(e,"space.text",0),m=al(e,"expandTextWidth",!1),y=al(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:al(e,"space.actionTop",0),bottom:al(e,"space.actionBottom",0),right:al(e,"space.actionRight",0)}:{left:al(e,"space.actionLeft",0),right:al(e,"space.actionRight",0),bottom:al(e,"space.actionBottom",0)},d=al(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wh.call(this,a,a,1)),!d)){var b=al(e,"actionSize");this.setActionSize(al(e,"actionWidth",b),al(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var ll={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=dl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const dl={down:0,up:1},cl=Eh.prototype.add,ul=Eh.prototype.addSpace;var pl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&ul.call(this),cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&ul.call(this),this.hasTailSpace=s}else cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cl.call(this,t,{index:r,proportion:i,expand:!0})}else cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},vl={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)ml.call(this,e[i],t);return this}},bl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Cl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,bl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xl={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Cl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Yl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Yl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Al=Phaser.Utils.Objects.IsPlainObject,Wl=Phaser.Utils.Objects.GetValue,Bl=Phaser.Display.Align.CENTER;var jl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Al(e)&&(e=Wl(r=e,"padding",0),i=Wl(r,"key",void 0),s=Wl(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Bl,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Il={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},Vl={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Kl.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)id.call(this,e[i],t);return this}};const rd=Phaser.Utils.Objects.GetValue;class nd extends Jl{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Tl({parent:this,eventEmitter:rd(e,"eventEmitter",this),groupName:rd(e,"groupName",void 0),clickConfig:rd(e,"click",void 0)}).setButtonsType(e);var s=rd(e,"background",void 0),r=rd(e,"buttons",void 0);this.buttonsAlign=rd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(nd.prototype,Ql,sd,_l,Ml);var hd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ad=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=od(t));var i=t[e];return"string"==typeof i&&(i=hd[i]),i},od=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ld=function(){return Array.prototype.reduce.call(arguments,dd,0)},dd=function(t,e){return t+e};const cd=Phaser.Utils.Objects.IsPlainObject,ud=Phaser.Utils.Objects.GetValue,pd=Phaser.Display.Align.CENTER;var vd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fd(this.sizerChildren,null),fh.call(this,t),this}},yd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,fd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue;class _d extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Od(e)?(e=kd(l=e,"x",0),i=kd(l,"y",0),s=kd(l,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(s)?(s=kd(l=s,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(n)?(n=kd(l=n,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(a)&&(a=kd(l=a,"columnProportions",0),o=kd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kd(l,"createCellContainerCallback")),this.setIndentLeft(kd(l,"space.indentLeftOdd",0),kd(l,"space.indentLeftEven",0)),this.setIndentTop(kd(l,"space.indentTopOdd",0),kd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=wd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(_d.prototype,Sd);const Td=Phaser.Utils.Objects.GetValue;var Ed=Phaser.Renderer.WebGL.Utils,Md=function(t,e,i,s,r,n){for(var h=Ed.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Yd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const zd=Phaser.Renderer.Canvas.SetTransform;var Ad={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ld(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Md(r,h,e,l,a,o),e.isStroked&&Rd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(zd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Bd.prototype,Ad);var jd=function(t){return t.x>0&&t.y>0},Id=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Fd=Phaser.Math.DegToRad;var Hd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Fc=Phaser.Utils.Objects.GetValue,Hc=Phaser.Utils.Objects.IsPlainObject;class Vc extends(gc(ac)){constructor(t,e,i,s,r,n,h,a){Hc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Hc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Hc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new jc).setName("trackFill")).addShape((new jc).setName("bar")).addShape((new jc).setName("trackStroke")),this.setTrackColor(Fc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Fc(a,"trackStrokeThickness",2),Fc(a,"trackStrokeColor",void 0)),this.setSkewX(Fc(a,"skewX",0)),this.setRTL(Fc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Gc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ic(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ic(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ic(a,0,0,e,i,t)}};Object.assign(Vc.prototype,Gc);var Nc=function(t){return null==t||""===t||0===t.length},Uc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Nc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Nc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=co(i),s=co(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return cu(t)?(this.stretchMode.edge=pu(uu(t,"edge",0)),this.stretchMode.internal=pu(uu(t,"internal",0))):(t=pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return gu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const mu=Phaser.Utils.Objects.IsPlainObject,yu=Phaser.Utils.Objects.GetValue,bu=Phaser.GameObjects;var Cu=void 0,xu=function(t,e){if(Cu||(Cu={},Ze(t).events.once("destroy",(function(){for(var t in Cu)Cu[t].destroy();Cu=void 0}))),!Cu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new bu[e](i)).setOrigin(0),Cu[e]=t}return Cu[e]};const Su=Phaser.GameObjects.RenderTexture;class wu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(mu(i)?(i=yu(d=i,"x",0),s=yu(d,"y",0),r=yu(d,"width",1),n=yu(d,"height",1),h=yu(d,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(r)?(r=yu(d=r,"width",1),n=yu(d,"height",1),h=yu(d,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(h)?(h=yu(d=h,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(a)?(a=yu(d=a,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=yu(d,"baseFrame",void 0)):mu(o)&&(o=yu(d=o,"columns",void 0),l=yu(d,"rows",void 0)),void 0===a&&(a=yu(d,"frame",void 0)),void 0===o){var c=yu(d,"leftWidth",void 0),u=yu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=yu(d,"topHeight",void 0),v=yu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(yu(d,"getFrameNameCallback",void 0)),this.setStretchMode(yu(d,"stretchMode",0)),this.setPreserveRatio(yu(d,"preserveRatio",!0));var g=yu(d,"maxFixedPartScale",1),f=yu(d,"maxFixedPartScaleX",g),m=yu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,fu),i}(Su,"rexNinePatch")){}var Pu={_drawImage:function(t,e,i,s,r,n){var h=xu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=xu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(wu.prototype,Pu);class Ou extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(qc(t,e))return t[e];var i=t.parent;return qc(i,e)?i[e]:void 0}set(t,e,i){return qc(t,e)?t[e]=i:qc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const ku=Phaser.Utils.Objects.GetValue;class _u extends wu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ku(e,"effects",!0);i&&eu(this,i),this.style=new Ou(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_u.prototype,Qd);const Tu=["alpha","tint","flipX","flipY"];var Eu=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new $c(t,e);break;case"image":s=new lu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _u(t,e):new nu(t,e);break;default:s=new tc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Tu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const hp=Phaser.Utils.Objects.GetValue,ap=Phaser.Math.Distance.Between;class op extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(hp(t,"enable",!0)),this.holdThreshold=hp(t,"holdThreshold",50),this.pointerOutReleaseEnable=hp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ap(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const lp=Phaser.Utils.Objects.GetValue;class dp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lp(t,"value",0)),this.setSpeed(lp(t,"speed",0)),this.setAcceleration(lp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class cp{constructor(){this.value,this.dir,this.movement=new dp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const gp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fp=Phaser.Utils.Objects.GetValue;class mp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fp(e,"speed",.1)),this.setEnable(fp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const yp=Phaser.Utils.Objects.GetValue;var bp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?yp(s,l,void 0):yp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new rp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=yp(r,"position",0);"string"==typeof p&&(p=Cp[p]);var v,g,f=yp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yp(s,"space.slider",void 0))&&(a?f=0:v=yp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:yp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yp(s,"scrollDetectionMode");"string"==typeof b&&(b=xp[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?yp(s,C,!0):yp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,P,O,k=yp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==b&&(k.focus=1===b?2:0),x=new mp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",P=`scroll${i}`):(S="t",P="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),y&&(a?(w=`childO${i}`,P=`scroll${i}`):(w="childOY",P="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Cp={right:0,left:1,bottom:0,top:1},xp={gameObject:0,rectBounds:1},Sp=Phaser.Utils.Objects.GetValue;var wp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sp(e,"width"),h=Sp(e,"height");n||Sp(e,"child.expandWidth",!0)||(s[1]=0),h||Sp(e,"child.expandHeight",!0)||(r[1]=0);var a=new _d(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Td(i,"child"),r=Td(s,"gameObject",void 0);if(r){var n=Td(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),a.left=Td(n,"left",0),a.right=Td(n,"right",0);break;case 1:h.top=Td(n,"left",0),h.bottom=Td(n,"right",0),a.top=Td(n,"top",0),a.bottom=Td(n,"bottom",0);break;default:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),h.left=Td(n,"left",0),h.right=Td(n,"right",0)}e.add(r,{column:1,row:1,align:Td(s,"align","center"),padding:a,expand:{width:Td(s,"expandWidth",!0),height:Td(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bp(t,a,"y",e);break;case 1:bp(t,a,"x",e);break;default:bp(t,a,"y",e),bp(t,a,"x",e)}return a},Pp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Op=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},kp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Up.prototype,Hp);const $p=["top","bottom","centerY","center"],Jp=["left","right","centerX","center"];var qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=$p.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Jp.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Kp=Phaser.Utils.Objects.GetValue;class Zp extends Mp{constructor(t,e){void 0===e&&(e={});var i=ad(e),s=Kp(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Kp(e,"clampChildOY",!1),s.clampChildOX=Kp(e,"clampChildOX",!1);var r,n,h=new Up(t,s);switch(t.add.existing(h),i){case 0:r=Kp(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Kp(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Kp(e,"align.panel","center")};var a=Kp(e,"space",void 0);a&&(a.child=Kp(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Qn(this.childrenMap.child,t),this}}var Qp={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:qp.call(this,t,"y",e);break;case 1:qp.call(this,t,"x",e);break;default:qp.call(this,t,"y",e),qp.call(this,t,"x",e)}return this}};Object.assign(Zp.prototype,Qp);const tv=Phaser.Utils.Objects.GetValue;var ev=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=iv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=sv(e,this.listCreateSliderTrackCallback),v=sv(e,this.listCreateSliderThumbCallback);d=new Zp(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:tv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=iv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},iv=function(t,e,i){var s;return i?(e.orientation="x",s=new nd(t,e)):(e.orientation="y",s=new Rl(t,e)),t.add.existing(s),s},sv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},rv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const av={down:0,up:1},ov=Phaser.Utils.Objects.GetValue;class lv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new ki(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),hv(t,e),t.isRexSizer&&t.layout();var i=ov(e,"touchOutsideClose",!1),s=ov(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var dv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},cv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ev.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new lv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(cv,ll,dv);const uv=Phaser.Utils.Objects.GetValue;class pv extends ol{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(uv(e,"options"));var i=uv(e,"list");this.setWrapEnable(uv(i,"wrap",!1)),this.setCreateButtonCallback(uv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uv(i,"scroller")),this.setListMouseWheelScrollerConfig(uv(i,"mouseWheelScroller")),this.setButtonClickCallback(uv(i,"onButtonClick")),this.setButtonOverCallback(uv(i,"onButtonOver")),this.setButtonOutCallback(uv(i,"onButtonOut")),this.setListExpandDirection(uv(i,"expandDirection")),this.setListEaseInDuration(uv(i,"easeIn",500)),this.setListEaseOutDuration(uv(i,"easeOut",100)),this.setListTransitInCallback(uv(i,"transitIn")),this.settListTransitOutCallback(uv(i,"transitOut")),this.setListMaxHeight(uv(i,"maxHeight",0)),this.setListSize(uv(i,"width"),uv(i,"height",0)),this.setListAlignmentMode(uv(i,"alignParent","text")),this.setListAlignmentSide(uv(i,"alignSide","")),this.setListBounds(uv(i,"bounds")),this.setListSpace(uv(i,"space")),this.setListDraggable(uv(i,"draggable",!1)),this.setValueChangeCallback(uv(e,"setValueCallback"),uv(e,"setValueCallbackScope")),this.setValue(uv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(pv.prototype,cv),pv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},De={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let ki=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const qi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Xs,Ys,zs,As);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;class Vs extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Gs=Phaser.Utils.Objects.GetValue;class Ns extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",Ks)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=qs.popUp;break;case ir.fadeIn:t=qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=qs.scaleDown;break;case ir.fadeOut:t=qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Cr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Pr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const kr=Phaser.Utils.Objects.GetValue;class _r extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class Rr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Xr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Yr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const Kr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class Cn extends qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=xn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,gn);const xn="IDLE",Sn="BEGIN",wn="RECOGNIZED",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Pn(e,"inputConfig",void 0)),this.setEventEmitter(Pn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Pn(t,"enable",!0)),this.bounds=Pn(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Dn:this.tracerState=Mn,this.onDrag1End();break;case Rn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ne);var En={};const Mn=0,Dn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Xn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Xn(t,e,i,s),t.rotation+=s,t},zn={};const An=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Vr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),Kn.call(t,e),t},th={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l,d,c){ge.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=uh[e];else if(lh(e)){var v;e=dh(v=e,"proportion",void 0),i=dh(v,"align",ch),s=dh(v,"padding",0),r=dh(v,"expand",!1),n=dh(v,"key",void 0),h=dh(v,"index",void 0),t.isRexSizer||(a=dh(v,"minWidth",void 0),o=dh(v,"minHeight",void 0)),l=dh(v,"fitRatio",0),d=dh(v,"offsetX",0),c=dh(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=pe(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Ch={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,vh,yh,bh,Ch,xh,Sh);var Ph=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ph.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Dh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Rh extends Eh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Mh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Mh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Rh.prototype,Dh);var Lh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Xh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Yh=Phaser.GameObjects.Graphics;class zh extends Yh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Xh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Lh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Lh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Wh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Bh=Phaser.GameObjects.Text;var jh=function(t){return t instanceof Bh};const Ih=Phaser.GameObjects.BitmapText;var Fh=function(t){return t instanceof Ih},Hh=/^[\x00-\x7F]+$/,Vh=function(t){return Hh.test(t)},Gh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Uh=2;const $h={none:0,word:1,char:Uh,character:Uh,mix:3};var Jh=function(t,e){var i=function(t){return Fh(t)?2:jh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Gh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e}};const qh=Phaser.Renderer.WebGL.Utils;var Kh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Zh=Phaser.Display.Color;var Qh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Zh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ta={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ea=Phaser.Display.Canvas.CanvasPool,ia=Phaser.GameObjects.GameObject,sa=Phaser.Utils.String.UUID;class ra extends ia{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ea.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=sa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ea.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const na=Phaser.GameObjects.Components;Phaser.Class.mixin(ra,[na.Alpha,na.BlendMode,na.Crop,na.Depth,na.Flip,na.GetBounds,na.Mask,na.Origin,na.Pipeline,na.PostPipeline,na.ScrollFactor,na.Tint,na.Transform,na.Visible,Kh,Qh,ta]);var ha={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class aa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(aa.prototype,ha);var oa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const la=Phaser.Math.RotateAround;var da;const ca=Phaser.Geom.Rectangle;var ua,pa=function(t){void 0===ua&&(ua=new ca);var e=t.drawTLX,i=t.drawTLY;return ua.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ua};const va=Phaser.Math.RotateAround;var ga,fa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=e,s.y=i,0!==t.rotation&&va(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ma=Phaser.GameObjects.Components.TransformMatrix;var ya,ba,Ca={},xa=function(t,e,i,s,r){var n=fa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ya&&(ya=new ma,ba=new ma),t.parentContainer?t.getWorldTransformMatrix(ya,ba):ya.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ya.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return xa(t,e,n,h,r)},wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===da&&(da={}),s=da),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&la(s,0,0,-i.rotation),s}(t,e,this,!0);return pa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sa(this.parent,this,t,e,i)}};Object.assign(wa,oa);const Pa=Phaser.Math.DegToRad,Oa=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class _a extends aa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Oa(this._rotation)}set angle(t){this.rotation=Pa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(_a.prototype,wa);const Ta=Phaser.Utils.String.Pad;var Ea=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ma=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Ra=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=La(Da(t,"tl",void 0),e,i),s.tr=La(Da(t,"tr",void 0),e,i),s.bl=La(Da(t,"bl",void 0),e,i),s.br=La(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var La=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Aa=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Ba=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,l,o,l,180,270,!1,h):Ba(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,l,o,l,270,360,!1,h):Ba(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,r-l,o,l,0,90,!1,h):Ba(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,r-l,o,l,90,180,!1,h):Ba(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Ia=Phaser.Utils.Objects.GetValue;class Fa extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ma("color2",t,this),Ma("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ma("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ma("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Va extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ea(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ga=Phaser.Utils.Objects.GetValue;class Na{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ga(t,"bold",!1)),this.setItalic(Ga(t,"italic",!1)),this.setFontSize(Ga(t,"fontSize","16px")),this.setFontFamily(Ga(t,"fontFamily","Courier")),this.setColor(Ga(t,"color","#fff")),this.setStrokeStyle(Ga(t,"stroke",null),Ga(t,"strokeThickness",0)),this.setShadow(Ga(t,"shadowColor",null),Ga(t,"shadowOffsetX",0),Ga(t,"shadowOffsetY",0),Ga(t,"shadowBlur",0)),this.setOffset(Ga(t,"offsetX",0),Ga(t,"offsetY",0)),this.setSpace(Ga(t,"leftSpace",0),Ga(t,"rightSpace",0)),this.setAlign(Ga(t,"align",void 0)),this.setBackgroundColor(Ga(t,"backgroundColor",null)),this.setBackgroundHeight(Ga(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ga(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ma("stroke",t,this),Ma("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ma("shadowOffsetX",t,this),Ma("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Na(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ea(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ea(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ea(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ea(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends _a{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class ho extends _a{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ao extends _a{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class oo extends _a{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class lo extends aa{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>co(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=co(t[i]));return e}var uo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const po={none:0,word:1,char:2,character:2,mix:3};var vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Co(t,"wrapMode");void 0===c&&(c=Co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=po[c]);var u=Co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Co(t,"letterSpacing",0),v=Co(t,"hAlign",0),g=Co(t,"vAlign",0),f=Co(t,"justifyPercentage",.25),m=uo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wo(t,"maxLines",0);var a=0===i,o=wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wo(t,"letterSpacing",0),p=wo(t,"rtl",!0),v=wo(t,"hAlign",p?2:0),g=wo(t,"vAlign",0),f=uo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Sa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=rl(t,r,e,i,n),a=0;a<=el&&0!==h;a++){if((r+=h)<0){r=0;break}h=rl(t,r,e,i,n)}return a===el&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nl(t,e,i),t},sl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rl=function(t,e,i,s,r){var n,h=sl(t,e,r),a=sl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},nl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const hl=Phaser.Utils.Objects.GetValue,al=Phaser.Utils.Objects.GetValue;class ol extends Rh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=al(e,"background",void 0),r=al(e,"icon",void 0),n=al(e,"iconMask",void 0),h=al(e,"text",void 0),a=al(e,"action",void 0),o=al(e,"actionMask",void 0),l=al(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:al(e,"space.icon",0),top:al(e,"space.iconTop",0),bottom:al(e,"space.iconBottom",0),left:al(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:al(e,"space.icon",0),left:al(e,"space.iconLeft",0),right:al(e,"space.iconRight",0),top:al(e,"space.iconTop",0)});var d=al(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wh.call(this,r,r,1)),!d){var c=al(e,"iconSize",void 0);this.setIconSize(al(e,"iconWidth",c),al(e,"iconHeight",c))}}if(h){var u=al(e,"wrapText",!1),p=al(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Jh(h,u),e.expandTextWidth=!0,tl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=hl(e,"minWidth",0),s=hl(e,"minHeight",0),r=hl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return il(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),il(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=al(e,"space.text",0),m=al(e,"expandTextWidth",!1),y=al(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:al(e,"space.actionTop",0),bottom:al(e,"space.actionBottom",0),right:al(e,"space.actionRight",0)}:{left:al(e,"space.actionLeft",0),right:al(e,"space.actionRight",0),bottom:al(e,"space.actionBottom",0)},d=al(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wh.call(this,a,a,1)),!d)){var b=al(e,"actionSize");this.setActionSize(al(e,"actionWidth",b),al(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var ll={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=dl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const dl={down:0,up:1},cl=Eh.prototype.add,ul=Eh.prototype.addSpace;var pl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&ul.call(this),cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&ul.call(this),this.hasTailSpace=s}else cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cl.call(this,t,{index:r,proportion:i,expand:!0})}else cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},vl={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)ml.call(this,e[i],t);return this}},bl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Cl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,bl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xl={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Cl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Yl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Yl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Al=Phaser.Utils.Objects.IsPlainObject,Wl=Phaser.Utils.Objects.GetValue,Bl=Phaser.Display.Align.CENTER;var jl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Al(e)&&(e=Wl(r=e,"padding",0),i=Wl(r,"key",void 0),s=Wl(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Bl,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Il={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},Vl={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Kl.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)id.call(this,e[i],t);return this}};const rd=Phaser.Utils.Objects.GetValue;class nd extends Jl{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Tl({parent:this,eventEmitter:rd(e,"eventEmitter",this),groupName:rd(e,"groupName",void 0),clickConfig:rd(e,"click",void 0)}).setButtonsType(e);var s=rd(e,"background",void 0),r=rd(e,"buttons",void 0);this.buttonsAlign=rd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(nd.prototype,Ql,sd,_l,Ml);var hd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ad=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=od(t));var i=t[e];return"string"==typeof i&&(i=hd[i]),i},od=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ld=function(){return Array.prototype.reduce.call(arguments,dd,0)},dd=function(t,e){return t+e};const cd=Phaser.Utils.Objects.IsPlainObject,ud=Phaser.Utils.Objects.GetValue,pd=Phaser.Display.Align.CENTER;var vd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fd(this.sizerChildren,null),fh.call(this,t),this}},yd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,fd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue;class _d extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Od(e)?(e=kd(l=e,"x",0),i=kd(l,"y",0),s=kd(l,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(s)?(s=kd(l=s,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(n)?(n=kd(l=n,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(a)&&(a=kd(l=a,"columnProportions",0),o=kd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kd(l,"createCellContainerCallback")),this.setIndentLeft(kd(l,"space.indentLeftOdd",0),kd(l,"space.indentLeftEven",0)),this.setIndentTop(kd(l,"space.indentTopOdd",0),kd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=wd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(_d.prototype,Sd);const Td=Phaser.Utils.Objects.GetValue;var Ed=Phaser.Renderer.WebGL.Utils,Md=function(t,e,i,s,r,n){for(var h=Ed.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Yd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const zd=Phaser.Renderer.Canvas.SetTransform;var Ad={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ld(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Md(r,h,e,l,a,o),e.isStroked&&Rd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(zd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Bd.prototype,Ad);var jd=function(t){return t.x>0&&t.y>0},Id=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Fd=Phaser.Math.DegToRad;var Hd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Fc=Phaser.Utils.Objects.GetValue,Hc=Phaser.Utils.Objects.IsPlainObject;class Vc extends(gc(ac)){constructor(t,e,i,s,r,n,h,a){Hc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Hc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Hc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new jc).setName("trackFill")).addShape((new jc).setName("bar")).addShape((new jc).setName("trackStroke")),this.setTrackColor(Fc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Fc(a,"trackStrokeThickness",2),Fc(a,"trackStrokeColor",void 0)),this.setSkewX(Fc(a,"skewX",0)),this.setRTL(Fc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Gc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ic(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ic(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ic(a,0,0,e,i,t)}};Object.assign(Vc.prototype,Gc);var Nc=function(t){return null==t||""===t||0===t.length},Uc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Nc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Nc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=co(i),s=co(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return cu(t)?(this.stretchMode.edge=pu(uu(t,"edge",0)),this.stretchMode.internal=pu(uu(t,"internal",0))):(t=pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return gu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const mu=Phaser.Utils.Objects.IsPlainObject,yu=Phaser.Utils.Objects.GetValue,bu=Phaser.GameObjects;var Cu=void 0,xu=function(t,e){if(Cu||(Cu={},Ze(t).events.once("destroy",(function(){for(var t in Cu)Cu[t].destroy();Cu=void 0}))),!Cu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new bu[e](i)).setOrigin(0),Cu[e]=t}return Cu[e]};const Su=Phaser.GameObjects.RenderTexture;class wu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(mu(i)?(i=yu(d=i,"x",0),s=yu(d,"y",0),r=yu(d,"width",1),n=yu(d,"height",1),h=yu(d,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(r)?(r=yu(d=r,"width",1),n=yu(d,"height",1),h=yu(d,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(h)?(h=yu(d=h,"key",void 0),a=yu(d,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):mu(a)?(a=yu(d=a,"baseFrame",void 0),o=yu(d,"columns",void 0),l=yu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=yu(d,"baseFrame",void 0)):mu(o)&&(o=yu(d=o,"columns",void 0),l=yu(d,"rows",void 0)),void 0===a&&(a=yu(d,"frame",void 0)),void 0===o){var c=yu(d,"leftWidth",void 0),u=yu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=yu(d,"topHeight",void 0),v=yu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(yu(d,"getFrameNameCallback",void 0)),this.setStretchMode(yu(d,"stretchMode",0)),this.setPreserveRatio(yu(d,"preserveRatio",!0));var g=yu(d,"maxFixedPartScale",1),f=yu(d,"maxFixedPartScaleX",g),m=yu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,fu),i}(Su,"rexNinePatch")){}var Pu={_drawImage:function(t,e,i,s,r,n){var h=xu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=xu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(wu.prototype,Pu);class Ou extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(qc(t,e))return t[e];var i=t.parent;return qc(i,e)?i[e]:void 0}set(t,e,i){return qc(t,e)?t[e]=i:qc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const ku=Phaser.Utils.Objects.GetValue;class _u extends wu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ku(e,"effects",!0);i&&eu(this,i),this.style=new Ou(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_u.prototype,Qd);const Tu=["alpha","tint","flipX","flipY"];var Eu=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new $c(t,e);break;case"image":s=new lu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _u(t,e):new nu(t,e);break;default:s=new tc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Tu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const hp=Phaser.Utils.Objects.GetValue,ap=Phaser.Math.Distance.Between;class op extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(hp(t,"enable",!0)),this.holdThreshold=hp(t,"holdThreshold",50),this.pointerOutReleaseEnable=hp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ap(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const lp=Phaser.Utils.Objects.GetValue;class dp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lp(t,"value",0)),this.setSpeed(lp(t,"speed",0)),this.setAcceleration(lp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class cp{constructor(){this.value,this.dir,this.movement=new dp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const gp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fp=Phaser.Utils.Objects.GetValue;class mp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fp(e,"speed",.1)),this.setEnable(fp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const yp=Phaser.Utils.Objects.GetValue;var bp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?yp(s,l,void 0):yp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new rp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=yp(r,"position",0);"string"==typeof p&&(p=Cp[p]);var v,g,f=yp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yp(s,"space.slider",void 0))&&(a?f=0:v=yp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:yp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yp(s,"scrollDetectionMode");"string"==typeof b&&(b=xp[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?yp(s,C,!0):yp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,P,O,k=yp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==b&&(k.focus=1===b?2:0),x=new mp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",P=`scroll${i}`):(S="t",P="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),y&&(a?(w=`childO${i}`,P=`scroll${i}`):(w="childOY",P="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Cp={right:0,left:1,bottom:0,top:1},xp={gameObject:0,rectBounds:1},Sp=Phaser.Utils.Objects.GetValue;var wp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sp(e,"width"),h=Sp(e,"height");n||Sp(e,"child.expandWidth",!0)||(s[1]=0),h||Sp(e,"child.expandHeight",!0)||(r[1]=0);var a=new _d(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Td(i,"child"),r=Td(s,"gameObject",void 0);if(r){var n=Td(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),a.left=Td(n,"left",0),a.right=Td(n,"right",0);break;case 1:h.top=Td(n,"left",0),h.bottom=Td(n,"right",0),a.top=Td(n,"top",0),a.bottom=Td(n,"bottom",0);break;default:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),h.left=Td(n,"left",0),h.right=Td(n,"right",0)}e.add(r,{column:1,row:1,align:Td(s,"align","center"),padding:a,expand:{width:Td(s,"expandWidth",!0),height:Td(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bp(t,a,"y",e);break;case 1:bp(t,a,"x",e);break;default:bp(t,a,"y",e),bp(t,a,"x",e)}return a},Pp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Op=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},kp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Up.prototype,Hp);const $p=["top","bottom","centerY","center"],Jp=["left","right","centerX","center"];var qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=$p.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Jp.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Kp=Phaser.Utils.Objects.GetValue;class Zp extends Mp{constructor(t,e){void 0===e&&(e={});var i=ad(e),s=Kp(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Kp(e,"clampChildOY",!1),s.clampChildOX=Kp(e,"clampChildOX",!1);var r,n,h=new Up(t,s);switch(t.add.existing(h),i){case 0:r=Kp(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Kp(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Kp(e,"align.panel","center")};var a=Kp(e,"space",void 0);a&&(a.child=Kp(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Qn(this.childrenMap.child,t),this}}var Qp={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:qp.call(this,t,"y",e);break;case 1:qp.call(this,t,"x",e);break;default:qp.call(this,t,"y",e),qp.call(this,t,"x",e)}return this}};Object.assign(Zp.prototype,Qp);const tv=Phaser.Utils.Objects.GetValue;var ev=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=iv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=sv(e,this.listCreateSliderTrackCallback),v=sv(e,this.listCreateSliderThumbCallback);d=new Zp(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:tv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=iv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},iv=function(t,e,i){var s;return i?(e.orientation="x",s=new nd(t,e)):(e.orientation="y",s=new Rl(t,e)),t.add.existing(s),s},sv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},rv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const av={down:0,up:1},ov=Phaser.Utils.Objects.GetValue;class lv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new ki(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),hv(t,e),t.isRexSizer&&t.layout();var i=ov(e,"touchOutsideClose",!1),s=ov(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var dv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},cv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ev.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new lv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(cv,ll,dv);const uv=Phaser.Utils.Objects.GetValue;class pv extends ol{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(uv(e,"options"));var i=uv(e,"list");this.setWrapEnable(uv(i,"wrap",!1)),this.setCreateButtonCallback(uv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uv(i,"scroller")),this.setListMouseWheelScrollerConfig(uv(i,"mouseWheelScroller")),this.setButtonClickCallback(uv(i,"onButtonClick")),this.setButtonOverCallback(uv(i,"onButtonOver")),this.setButtonOutCallback(uv(i,"onButtonOut")),this.setListExpandDirection(uv(i,"expandDirection")),this.setListEaseInDuration(uv(i,"easeIn",500)),this.setListEaseOutDuration(uv(i,"easeOut",100)),this.setListTransitInCallback(uv(i,"transitIn")),this.settListTransitOutCallback(uv(i,"transitOut")),this.setListMaxHeight(uv(i,"maxHeight",0)),this.setListSize(uv(i,"width"),uv(i,"height",0)),this.setListAlignmentMode(uv(i,"alignParent","text")),this.setListAlignmentSide(uv(i,"alignSide","")),this.setListBounds(uv(i,"bounds")),this.setListSpace(uv(i,"space")),this.setListDraggable(uv(i,"draggable",!1)),this.setValueChangeCallback(uv(e,"setValueCallback"),uv(e,"setValueCallbackScope")),this.setValue(uv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(pv.prototype,cv),pv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); diff --git a/dist/rexexpbar.js b/dist/rexexpbar.js index 0f38e14c7c..9586370b45 100644 --- a/dist/rexexpbar.js +++ b/dist/rexexpbar.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$8(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$8(config, 'offsetX', 0); + offsetY = GetValue$8(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexexpbar.min.js b/dist/rexexpbar.min.js index 77e5e50970..7af03ad300 100644 --- a/dist/rexexpbar.min.js +++ b/dist/rexexpbar.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var P={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},O={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=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};const _e=/(\S+)\[(\d+)\]/i,we=Phaser.Utils.Objects.GetValue;var Pe=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=we(e,"left",0),t.right=we(e,"right",0),t.top=we(e,"top",0),t.bottom=we(e,"bottom",0)),t},Oe={getInnerPadding(t){return Pe(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Pe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Pe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class bi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class ki extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var wi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Pi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Oi=function(t){return Ei(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Oi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Oi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Oi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Oi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Fi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Oi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Oi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Oi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,ji),Ui.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Hi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Oi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Oi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Oi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Oi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Oi(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Os={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Ft),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Ft),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Os,Ms,Ds,Rs);const zs=Phaser.Utils.Objects.GetValue;class As extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ls);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Is extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Vs extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Ws extends Vs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wi(t,e)},scaleDown(t,e){Pi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Hs=function(t,e){Yi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ws(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Bs.popUp;break;case Zs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Bs.scaleDown;break;case Zs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const mr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const xr=Phaser.Utils.Objects.GetValue;class Sr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ps{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const wr=Phaser.Utils.Objects.GetValue;class Pr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Zr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Kr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const un=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=gn},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=gn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=gn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const gn="IDLE",mn="BEGIN",fn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=wn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=kn,this.onDrag1End();break;case wn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Pn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(Sn.prototype,We);var Tn={};const kn=0,_n=1,wn=2,Pn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var On=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Mn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(zn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=Rn(zn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Xn="BEGIN",Vn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Lr.call(t,e),Fr.call(t,e),Vr.call(t,e),Ur.call(t,e),Nn.call(t,e),Un.call(t,e),Bn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Ot(t)},getChildPrevState:function(t){var e=Ot(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=aa[e];else if(sa(e)){var u;e=ra(u=e,"proportion",void 0),i=ra(u,"align",na),s=ra(u,"padding",0),r=ra(u,"expand",!1),n=ra(u,"key",void 0),a=ra(u,"index",void 0),t.isRexSizer||(h=ra(u,"minWidth",void 0),o=ra(u,"minHeight",void 0)),l=ra(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Et.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ga={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ma={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,m=u,f=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(fa,oa,ua,pa,va,ga,ma);var ya=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){ba(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):ba(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):ba(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ca[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,fa);const Ta=Phaser.Renderer.WebGL.Utils;var ka={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _a=Phaser.Display.Color;var wa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _a);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Pa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Ea=Phaser.Display.Canvas.CanvasPool,Oa=Phaser.GameObjects.GameObject,Ma=Phaser.Utils.String.UUID;class Da extends Oa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Ea.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ma(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Ea.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ra=Phaser.GameObjects.Components;Phaser.Class.mixin(Da,[Ra.Alpha,Ra.BlendMode,Ra.Crop,Ra.Depth,Ra.Flip,Ra.GetBounds,Ra.Mask,Ra.Origin,Ra.Pipeline,Ra.PostPipeline,Ra.ScrollFactor,Ra.Tint,Ra.Transform,Ra.Visible,ka,wa,Pa]);const La=Phaser.Math.Linear,za=Phaser.Math.Percent;var Aa={setValue(t,e,i){return null==t||(void 0!==e&&(t=za(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=za(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=La(t,e,i)),i}};const Fa=Phaser.Math.Percent;var Ia={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Fa(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Xa=Phaser.Utils.Objects.GetValue,Va=Phaser.Math.Clamp;function Ya(t){class e extends t{bootProgressBase(t){this.eventEmitter=Xa(t,"eventEmitter",this);var e=Xa(t,"valuechangeCallback",null);if(null!==e){var i=Xa(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Xa(t,"easeValue.duration",0)).setEaseValueFunction(Xa(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Va(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,Aa,Ia),e}const Na=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Na(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ua=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Ua(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ba=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var h;return r>=0?((h=n[0]).x=t+r,h.y=e,(h=n[1]).x=i+r,h.y=e,(h=n[2]).x=i,h.y=s,(h=n[3]).x=t,h.y=s):((h=n[0]).x=t,h.y=e,(h=n[1]).x=i,h.y=e,(h=n[2]).x=i-r,h.y=s,(h=n[3]).x=t-r,h.y=s),n};const Ga=Phaser.Utils.Objects.GetValue,Ha=Phaser.Utils.Objects.IsPlainObject;class Ja extends(Ya(Da)){constructor(t,e,i,s,r,n,a,h){Ha(e)?(e=Ga(h=e,"x",0),i=Ga(h,"y",0),s=Ga(h,"width",2),r=Ga(h,"height",2),n=Ga(h,"barColor",void 0),a=Ga(h,"value",0)):Ha(s)?(s=Ga(h=s,"width",2),r=Ga(h,"height",2),n=Ga(h,"barColor",void 0),a=Ga(h,"value",0)):Ha(n)&&(n=Ga(h=n,"barColor",void 0),a=Ga(h,"value",0)),super(t,e,i,s,r,Ga(h,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(h),this.setTrackColor(Ga(h,"trackColor",void 0)),this.setBarColor(n,Ga(h,"barColor2",void 0),Ga(h,"isHorizontalGradient",void 0)),this.setTrackStroke(Ga(h,"trackStrokeThickness",2),Ga(h,"trackStrokeColor",void 0)),this.setSkewX(Ga(h,"skewX",0)),this.setRTL(Ga(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Wa.call(this)}),this),this}}var $a=function(t,e,i,s,r,n,a,h,o,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=h&&(e.strokeStyle=h,e.lineWidth=o,e.stroke())};const qa=Phaser.Math.PI2;var Za=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,h=this.startAngle,o=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),$a(0,n,e,e,s,s,void 0,this.trackColor,i,h,o,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?o:a?(h-l*this.value+qa)%qa:(h+l*this.value)%qa,n.save(),this.barColor2){var u=e+s*Math.cos(h),p=e+s*Math.sin(h),v=e+s*Math.cos(d),g=e+s*Math.sin(d),m=n.createLinearGradient(u,p,v,g);m.addColorStop(0,this.barColor2),m.addColorStop(1,this.barColor),c=m}else c=this.barColor;$a(0,n,e,e,s,s,void 0,c,i,h,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),$a(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,h,o,l,d){void 0===o&&null!=h&&(o=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=h,e.lineWidth=o,e.lineCap="round",e.lineJoin="round",null!=h&&"none"!==h&&o>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const Ka=Phaser.Utils.Objects.GetValue,Qa=Phaser.Utils.Objects.IsPlainObject,th=Phaser.Math.Clamp,eh=Phaser.Math.DegToRad(270),ih=Phaser.Math.PI2;class sh extends(Ya(Da)){constructor(t,e,i,s,r,n,a){Qa(e)&&(e=Ka(a=e,"x",0),i=Ka(a,"y",0),s=Ka(a,"radius",1),r=Ka(a,"barColor",void 0),n=Ka(a,"value",0));var h=2*s;super(t,e,i,h,h,Ka(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Ka(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(Ka(a,"barColor2",void 0)),this.setCenterColor(Ka(a,"centerColor",void 0)),this.setThickness(Ka(a,"thickness",.2)),this.setStartAngle(Ka(a,"startAngle",eh)),this.setEndAngle(Ka(a,"endAngle",this.startAngle+ih)),this.setAnticlockwise(Ka(a,"anticlockwise",!1)),this.setTextColor(Ka(a,"textColor",void 0)),this.setTextStrokeColor(Ka(a,"textStrokeColor",void 0),Ka(a,"textStrokeThickness",void 0));var o=Ka(a,"textFont",void 0);o?this.setTextFont(o):this.setTextFont(Ka(a,"textSize","16px"),Ka(a,"textFamily","Courier"),Ka(a,"textStyle","")),this.setTextFormatCallback(Ka(a,"textFormatCallback",void 0),Ka(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=th(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),Za.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var rh=function(t,e,i){return i?t<=e?ih+t-e:t-e:t>=e?ih+e-t:e-t},nh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const ah=Phaser.GameObjects.Graphics;class hh extends ah{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=oh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,nh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,nh.call(this,this.width,this.height,this.padding,t,e)),this}}const oh={rectangle:0,circle:1};var lh=function(t,e,i,s){var r=new hh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Utils.Objects.IsPlainObject;var uh=function(t,e){var i=dh(e,"background",void 0),s=dh(e,"icon",void 0),r=dh(e,"iconMask",void 0),n=dh(e,"nameText",void 0),a=dh(e,"valueText",void 0),h=dh(e,"bar",void 0),o=dh(e,"action",void 0),l=dh(e,"actionMask",void 0),d="line"===dh(e,"barShape","line");ch(h)&&(h=new(d?Ja:sh)(t,h),t.add.existing(h),n&&t.children.moveBelow(h,n),a&&t.children.moveBelow(h,a));var c=n||a||h;if(i&&this.addBackground(i),s){var u=void 0;0===this.orientation?(c||o)&&(u={right:dh(e,"space.icon",0),top:dh(e,"space.iconTop",0),bottom:dh(e,"space.iconBottom",0)}):(c||o)&&(u={bottom:dh(e,"space.icon",0),left:dh(e,"space.iconLeft",0),right:dh(e,"space.iconRight",0)}),this.add(s,{proportion:0,padding:u}),r&&(r=lh.call(this,s,s,1))}if(c){var p,v=new Sa(t,{orientation:1});if(n||a){if(p=new Sa(t,{orientation:0}),n){""===n.text&&n.setText(" "),n.setOrigin(0,n.originY);var u={left:dh(e,"space.name",0)};p.add(n,{padding:u})}a&&(""===a.text&&a.setText(" "),a.setOrigin(1,a.originY),p.addSpace(),u={right:dh(e,"space.value",0)},p.add(a,{padding:u}),this.setValueTextFormatCallback(dh(e,"valueTextFormatCallback",ph),dh(e,"valueTextFormatCallbackScope",void 0))),v.add(p,{expand:!0})}if(h)if(d){var g=p?dh(e,"space.bar"):0;void 0===g&&(g=dh(e,"space.barTop",0)),u={top:g,bottom:dh(e,"space.barBottom",0),left:dh(e,"space.barLeft",0),right:dh(e,"space.barRight",0)},v.add(h,{expand:!0,padding:u})}else u={top:dh(e,"space.barTop",0),bottom:dh(e,"space.barBottom",0),left:dh(e,"space.barLeft",0),right:dh(e,"space.barRight",0)},this.addBackground(h,u);u=void 0,o&&(u={right:dh(e,"space.text",0)});var m=dh(e,"align.text","bottom");this.add(v,{proportion:1,align:m,padding:u})}o&&(u=0===this.orientation?{top:dh(e,"space.actionTop",0),bottom:dh(e,"space.actionBottom",0)}:{left:dh(e,"space.actionLeft",0),right:dh(e,"space.actionRight",0)},this.add(o,{proportion:0,padding:u}),l&&(l=lh.call(this,o,o,1))),this.addChildrenMap("background",i),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("name",n),this.addChildrenMap("value",a),this.addChildrenMap("bar",h),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)},ph=function(t,e,i){return t.toString()};const vh=Phaser.Math.Clamp;var gh={setValueTextFormatCallback(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText(t,e,i){var s=this.childrenMap.value;return s&&this.valueTextFormatCallback&&(s.setText(this.getFormatValueText(t,e,i)),s.layout&&s.layout()),this},setValue(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,t=vh(t,e,i),this.value=t,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this},setEaseValueDuration(t){return this.easeValueDuration=t,this},easeValueTo(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,void 0===this.easeValueTask&&(this.easeValueTask=new ls(this),this.easeValueTask.on("update",(function(){this.setValue(this.value,this.minValue,this.maxValue)}),this)),this.easeValueTask.restart({key:"value",to:t,duration:this.easeValueDuration}),this}};class mh extends Sa{constructor(t,e){super(t,e),this.type="rexNameValueLabel",uh.call(this,t,e),this.setEaseValueDuration(1e3)}get nameText(){var t=this.childrenMap.name;return void 0===t?"":t.text}set nameText(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t)}setNameText(t){return this.nameText=t,this}get valueText(){var t=this.childrenMap.value;return void 0===t?"":t.text}set valueText(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t)}setValueText(t){return this.valueText=t,this}get barValue(){var t=this.childrenMap.bar;if(void 0!==t)return t.value}set barValue(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t)}setBarValue(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.setValue(t,e,i),this}easeBarValueTo(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.easeValueTo(t,e,i),this}setTexture(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}get texture(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}get frame(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(mh.prototype,gh);class fh extends bs{constructor(t){super(),this.setTable(Ss(t,"table")),this.setMaxLevel(Ss(t,"maxLevel"));var e=Ss(t,"exp",0),i=Ss(t,"level",void 0);void 0===i||this.checkLevel(i,e)||(console.error(`Level ${i} and Exp ${e} are mismatch`),i=void 0),this.resetExp(e,i)}setTable(t){return this.levelTable=t,this.isLevelMapFunction=Ks(t),this}setMaxLevel(t){var e;return void 0===t&&(t=Array.isArray(this.levelTable)?this.levelTable.length-1:-1),e=-1!==t?this.getExp(t):-1,this.hasMaxLevel=-1!==t,this.maxLevel=t,this.maxExp=e,this}resetExp(t,e){return this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=_h(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(nr(s)||(s=xh(Mh,i,1)),_h(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=Rh[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Dh[t]),this.timeUnit=t,this}}var Mh=[];const Dh={ms:0,s:1,sec:1},Rh={abs:0,absolute:0,inc:1,increment:1};var Lh=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,Ft).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},zh={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const Ah=Phaser.Utils.Objects.GetValue;class Fh extends mh{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(Ah(e,"easeDuration",1e3)),this.levelCounter=new fh(Ah(e,"levelCounter")),this.player=new Oh(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",Lh,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}return Object.assign(Fh.prototype,zh),Fh},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexexpbar=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var P={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},O={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=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};const _e=/(\S+)\[(\d+)\]/i,we=Phaser.Utils.Objects.GetValue;var Pe=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=we(e,"left",0),t.right=we(e,"right",0),t.top=we(e,"top",0),t.bottom=we(e,"bottom",0)),t},Oe={getInnerPadding(t){return Pe(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Pe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Pe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class bi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class ki extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const _i={stop:0,destroy:1,yoyo:2};var wi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Pi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Oi=function(t){return Ei(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Oi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Oi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Oi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Oi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Fi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Oi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Oi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Oi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,ji),Ui.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Hi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Oi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Oi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Oi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Oi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Oi(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Os={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Ft),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Ft),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Os,Ms,Ds,Rs);const zs=Phaser.Utils.Objects.GetValue;class As extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ls);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Is extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Vs extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Ws extends Vs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wi(t,e)},scaleDown(t,e){Pi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Hs=function(t,e){Yi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ws(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Bs.popUp;break;case Zs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Bs.scaleDown;break;case Zs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const mr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const xr=Phaser.Utils.Objects.GetValue;class Sr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Ps{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const wr=Phaser.Utils.Objects.GetValue;class Pr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Zr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Kr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const un=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=gn},eventEmitter:!1};this.setRecongizedStateObject(new Ps(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=gn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=gn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const gn="IDLE",mn="BEGIN",fn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=wn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=kn,this.onDrag1End();break;case wn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==wn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Pn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(Sn.prototype,We);var Tn={};const kn=0,_n=1,wn=2,Pn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var On=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Mn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(zn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=Rn(zn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Xn="BEGIN",Vn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Lr.call(t,e),Fr.call(t,e),Vr.call(t,e),Ur.call(t,e),Nn.call(t,e),Un.call(t,e),Bn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Ot(t)},getChildPrevState:function(t){var e=Ot(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l,d,c){pe.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=aa[e];else if(sa(e)){var v;e=ra(v=e,"proportion",void 0),i=ra(v,"align",na),s=ra(v,"padding",0),r=ra(v,"expand",!1),n=ra(v,"key",void 0),a=ra(v,"index",void 0),t.isRexSizer||(h=ra(v,"minWidth",void 0),o=ra(v,"minHeight",void 0)),l=ra(v,"fitRatio",0),d=ra(v,"offsetX",0),c=ra(v,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Et.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ga={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ma={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,m=u,f=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(fa,oa,ua,pa,va,ga,ma);var ya=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){ba(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):ba(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):ba(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ca[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,fa);const Ta=Phaser.Renderer.WebGL.Utils;var ka={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Ta.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _a=Phaser.Display.Color;var wa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _a);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Pa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Ea=Phaser.Display.Canvas.CanvasPool,Oa=Phaser.GameObjects.GameObject,Ma=Phaser.Utils.String.UUID;class Da extends Oa{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Ea.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ma(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Ea.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Ra=Phaser.GameObjects.Components;Phaser.Class.mixin(Da,[Ra.Alpha,Ra.BlendMode,Ra.Crop,Ra.Depth,Ra.Flip,Ra.GetBounds,Ra.Mask,Ra.Origin,Ra.Pipeline,Ra.PostPipeline,Ra.ScrollFactor,Ra.Tint,Ra.Transform,Ra.Visible,ka,wa,Pa]);const La=Phaser.Math.Linear,za=Phaser.Math.Percent;var Aa={setValue(t,e,i){return null==t||(void 0!==e&&(t=za(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=za(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=La(t,e,i)),i}};const Fa=Phaser.Math.Percent;var Ia={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Fa(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Xa=Phaser.Utils.Objects.GetValue,Va=Phaser.Math.Clamp;function Ya(t){class e extends t{bootProgressBase(t){this.eventEmitter=Xa(t,"eventEmitter",this);var e=Xa(t,"valuechangeCallback",null);if(null!==e){var i=Xa(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Xa(t,"easeValue.duration",0)).setEaseValueFunction(Xa(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Va(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,Aa,Ia),e}const Na=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Na(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ua=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Ua(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ba=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var h;return r>=0?((h=n[0]).x=t+r,h.y=e,(h=n[1]).x=i+r,h.y=e,(h=n[2]).x=i,h.y=s,(h=n[3]).x=t,h.y=s):((h=n[0]).x=t,h.y=e,(h=n[1]).x=i,h.y=e,(h=n[2]).x=i-r,h.y=s,(h=n[3]).x=t-r,h.y=s),n};const Ga=Phaser.Utils.Objects.GetValue,Ha=Phaser.Utils.Objects.IsPlainObject;class Ja extends(Ya(Da)){constructor(t,e,i,s,r,n,a,h){Ha(e)?(e=Ga(h=e,"x",0),i=Ga(h,"y",0),s=Ga(h,"width",2),r=Ga(h,"height",2),n=Ga(h,"barColor",void 0),a=Ga(h,"value",0)):Ha(s)?(s=Ga(h=s,"width",2),r=Ga(h,"height",2),n=Ga(h,"barColor",void 0),a=Ga(h,"value",0)):Ha(n)&&(n=Ga(h=n,"barColor",void 0),a=Ga(h,"value",0)),super(t,e,i,s,r,Ga(h,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(h),this.setTrackColor(Ga(h,"trackColor",void 0)),this.setBarColor(n,Ga(h,"barColor2",void 0),Ga(h,"isHorizontalGradient",void 0)),this.setTrackStroke(Ga(h,"trackStrokeThickness",2),Ga(h,"trackStrokeColor",void 0)),this.setSkewX(Ga(h,"skewX",0)),this.setRTL(Ga(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Wa.call(this)}),this),this}}var $a=function(t,e,i,s,r,n,a,h,o,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=h&&(e.strokeStyle=h,e.lineWidth=o,e.stroke())};const qa=Phaser.Math.PI2;var Za=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,h=this.startAngle,o=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),$a(0,n,e,e,s,s,void 0,this.trackColor,i,h,o,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?o:a?(h-l*this.value+qa)%qa:(h+l*this.value)%qa,n.save(),this.barColor2){var u=e+s*Math.cos(h),p=e+s*Math.sin(h),v=e+s*Math.cos(d),g=e+s*Math.sin(d),m=n.createLinearGradient(u,p,v,g);m.addColorStop(0,this.barColor2),m.addColorStop(1,this.barColor),c=m}else c=this.barColor;$a(0,n,e,e,s,s,void 0,c,i,h,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),$a(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,h,o,l,d){void 0===o&&null!=h&&(o=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=h,e.lineWidth=o,e.lineCap="round",e.lineJoin="round",null!=h&&"none"!==h&&o>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const Ka=Phaser.Utils.Objects.GetValue,Qa=Phaser.Utils.Objects.IsPlainObject,th=Phaser.Math.Clamp,eh=Phaser.Math.DegToRad(270),ih=Phaser.Math.PI2;class sh extends(Ya(Da)){constructor(t,e,i,s,r,n,a){Qa(e)&&(e=Ka(a=e,"x",0),i=Ka(a,"y",0),s=Ka(a,"radius",1),r=Ka(a,"barColor",void 0),n=Ka(a,"value",0));var h=2*s;super(t,e,i,h,h,Ka(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Ka(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(Ka(a,"barColor2",void 0)),this.setCenterColor(Ka(a,"centerColor",void 0)),this.setThickness(Ka(a,"thickness",.2)),this.setStartAngle(Ka(a,"startAngle",eh)),this.setEndAngle(Ka(a,"endAngle",this.startAngle+ih)),this.setAnticlockwise(Ka(a,"anticlockwise",!1)),this.setTextColor(Ka(a,"textColor",void 0)),this.setTextStrokeColor(Ka(a,"textStrokeColor",void 0),Ka(a,"textStrokeThickness",void 0));var o=Ka(a,"textFont",void 0);o?this.setTextFont(o):this.setTextFont(Ka(a,"textSize","16px"),Ka(a,"textFamily","Courier"),Ka(a,"textStyle","")),this.setTextFormatCallback(Ka(a,"textFormatCallback",void 0),Ka(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=rh(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=th(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),Za.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var rh=function(t,e,i){return i?t<=e?ih+t-e:t-e:t>=e?ih+e-t:e-t},nh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const ah=Phaser.GameObjects.Graphics;class hh extends ah{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=oh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,nh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,nh.call(this,this.width,this.height,this.padding,t,e)),this}}const oh={rectangle:0,circle:1};var lh=function(t,e,i,s){var r=new hh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Utils.Objects.IsPlainObject;var uh=function(t,e){var i=dh(e,"background",void 0),s=dh(e,"icon",void 0),r=dh(e,"iconMask",void 0),n=dh(e,"nameText",void 0),a=dh(e,"valueText",void 0),h=dh(e,"bar",void 0),o=dh(e,"action",void 0),l=dh(e,"actionMask",void 0),d="line"===dh(e,"barShape","line");ch(h)&&(h=new(d?Ja:sh)(t,h),t.add.existing(h),n&&t.children.moveBelow(h,n),a&&t.children.moveBelow(h,a));var c=n||a||h;if(i&&this.addBackground(i),s){var u=void 0;0===this.orientation?(c||o)&&(u={right:dh(e,"space.icon",0),top:dh(e,"space.iconTop",0),bottom:dh(e,"space.iconBottom",0)}):(c||o)&&(u={bottom:dh(e,"space.icon",0),left:dh(e,"space.iconLeft",0),right:dh(e,"space.iconRight",0)}),this.add(s,{proportion:0,padding:u}),r&&(r=lh.call(this,s,s,1))}if(c){var p,v=new Sa(t,{orientation:1});if(n||a){if(p=new Sa(t,{orientation:0}),n){""===n.text&&n.setText(" "),n.setOrigin(0,n.originY);var u={left:dh(e,"space.name",0)};p.add(n,{padding:u})}a&&(""===a.text&&a.setText(" "),a.setOrigin(1,a.originY),p.addSpace(),u={right:dh(e,"space.value",0)},p.add(a,{padding:u}),this.setValueTextFormatCallback(dh(e,"valueTextFormatCallback",ph),dh(e,"valueTextFormatCallbackScope",void 0))),v.add(p,{expand:!0})}if(h)if(d){var g=p?dh(e,"space.bar"):0;void 0===g&&(g=dh(e,"space.barTop",0)),u={top:g,bottom:dh(e,"space.barBottom",0),left:dh(e,"space.barLeft",0),right:dh(e,"space.barRight",0)},v.add(h,{expand:!0,padding:u})}else u={top:dh(e,"space.barTop",0),bottom:dh(e,"space.barBottom",0),left:dh(e,"space.barLeft",0),right:dh(e,"space.barRight",0)},this.addBackground(h,u);u=void 0,o&&(u={right:dh(e,"space.text",0)});var m=dh(e,"align.text","bottom");this.add(v,{proportion:1,align:m,padding:u})}o&&(u=0===this.orientation?{top:dh(e,"space.actionTop",0),bottom:dh(e,"space.actionBottom",0)}:{left:dh(e,"space.actionLeft",0),right:dh(e,"space.actionRight",0)},this.add(o,{proportion:0,padding:u}),l&&(l=lh.call(this,o,o,1))),this.addChildrenMap("background",i),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("name",n),this.addChildrenMap("value",a),this.addChildrenMap("bar",h),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)},ph=function(t,e,i){return t.toString()};const vh=Phaser.Math.Clamp;var gh={setValueTextFormatCallback(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText(t,e,i){var s=this.childrenMap.value;return s&&this.valueTextFormatCallback&&(s.setText(this.getFormatValueText(t,e,i)),s.layout&&s.layout()),this},setValue(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,t=vh(t,e,i),this.value=t,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this},setEaseValueDuration(t){return this.easeValueDuration=t,this},easeValueTo(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,void 0===this.easeValueTask&&(this.easeValueTask=new ls(this),this.easeValueTask.on("update",(function(){this.setValue(this.value,this.minValue,this.maxValue)}),this)),this.easeValueTask.restart({key:"value",to:t,duration:this.easeValueDuration}),this}};class mh extends Sa{constructor(t,e){super(t,e),this.type="rexNameValueLabel",uh.call(this,t,e),this.setEaseValueDuration(1e3)}get nameText(){var t=this.childrenMap.name;return void 0===t?"":t.text}set nameText(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t)}setNameText(t){return this.nameText=t,this}get valueText(){var t=this.childrenMap.value;return void 0===t?"":t.text}set valueText(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t)}setValueText(t){return this.valueText=t,this}get barValue(){var t=this.childrenMap.bar;if(void 0!==t)return t.value}set barValue(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t)}setBarValue(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.setValue(t,e,i),this}easeBarValueTo(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.easeValueTo(t,e,i),this}setTexture(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}get texture(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}get frame(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(mh.prototype,gh);class fh extends bs{constructor(t){super(),this.setTable(Ss(t,"table")),this.setMaxLevel(Ss(t,"maxLevel"));var e=Ss(t,"exp",0),i=Ss(t,"level",void 0);void 0===i||this.checkLevel(i,e)||(console.error(`Level ${i} and Exp ${e} are mismatch`),i=void 0),this.resetExp(e,i)}setTable(t){return this.levelTable=t,this.isLevelMapFunction=Ks(t),this}setMaxLevel(t){var e;return void 0===t&&(t=Array.isArray(this.levelTable)?this.levelTable.length-1:-1),e=-1!==t?this.getExp(t):-1,this.hasMaxLevel=-1!==t,this.maxLevel=t,this.maxExp=e,this}resetExp(t,e){return this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=_h(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(nr(s)||(s=xh(Mh,i,1)),_h(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=Rh[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Dh[t]),this.timeUnit=t,this}}var Mh=[];const Dh={ms:0,s:1,sec:1},Rh={abs:0,absolute:0,inc:1,increment:1};var Lh=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,Ft).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},zh={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const Ah=Phaser.Utils.Objects.GetValue;class Fh extends mh{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(Ah(e,"easeDuration",1e3)),this.levelCounter=new fh(Ah(e,"levelCounter")),this.player=new Oh(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",Lh,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}return Object.assign(Fh.prototype,zh),Fh},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexexpbar=e(); diff --git a/dist/rexfileselectorbutton.js b/dist/rexfileselectorbutton.js index 0c75be26f2..bfe4e3d78c 100644 --- a/dist/rexfileselectorbutton.js +++ b/dist/rexfileselectorbutton.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$e(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$e(config, 'offsetX', 0); + offsetY = GetValue$e(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexfileselectorbutton.min.js b/dist/rexfileselectorbutton.min.js index 3406557b1e..f8d974de96 100644 --- a/dist/rexfileselectorbutton.min.js +++ b/dist/rexfileselectorbutton.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ye={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ti={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Yi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Yi(t,h):s.resetFromJSON(h),s.restart(),s},Wi=function(t,e,i,s){i instanceof Yi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Yi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const zs=Phaser.Utils.Objects.GetValue;class As extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ls);var Ys=function(t){if(t.parentContainer)return Ys(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ys(e):t};class Xs extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ys(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Is extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Wi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Vs=function(t,e){Wi(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case Tn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Ne);var wn={};const Sn=0,Pn=1,Tn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const Yn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Ar.call(t,e),Fr.call(t,e),Br.call(t,e),Wn.call(t,e),Bn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l){pe.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=nh[e];else if(ih(e)){var u;e=sh(u=e,"proportion",void 0),i=sh(u,"align",rh),s=sh(u,"padding",0),r=sh(u,"expand",!1),n=sh(u,"key",void 0),h=sh(u,"index",void 0),t.isRexSizer||(a=sh(u,"minWidth",void 0),o=sh(u,"minHeight",void 0)),l=sh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=kt.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(We(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){bh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends xh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Sh);var Th=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class _h extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=kh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Th.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Th.call(this,this.width,this.height,this.padding,t,e)),this}}const kh={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.GameObjects.Text;var Rh=function(t){return t instanceof Mh};const Dh=Phaser.GameObjects.BitmapText;var Lh=function(t){return t instanceof Dh},zh=/^[\x00-\x7F]+$/,Ah=function(t){return zh.test(t)},Yh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Fh=2;const Ih={none:0,word:1,char:Fh,character:Fh,mix:3};var Wh=function(t,e){var i=function(t){return Lh(t)?2:Rh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Ih[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Yh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ih[e]||0),t.style.wrapMode=e}};const jh=Phaser.Renderer.WebGL.Utils;var Bh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=jh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Hh=Phaser.Display.Color;var Nh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Hh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Uh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Gh=Phaser.Display.Canvas.CanvasPool,Vh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class Jh extends Vh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Gh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Gh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Jh,[qh.Alpha,qh.BlendMode,qh.Crop,qh.Depth,qh.Flip,qh.GetBounds,qh.Mask,qh.Origin,qh.Pipeline,qh.PostPipeline,qh.ScrollFactor,qh.Tint,qh.Transform,qh.Visible,Bh,Nh,Uh]);var Zh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Kh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Kh.prototype,Zh);var Qh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ta=Phaser.Math.RotateAround;var ea;const ia=Phaser.Geom.Rectangle;var sa,ra=function(t){void 0===sa&&(sa=new ia);var e=t.drawTLX,i=t.drawTLY;return sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),sa};const na=Phaser.Math.RotateAround;var ha,aa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=e,s.y=i,0!==t.rotation&&na(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const oa=Phaser.GameObjects.Components.TransformMatrix;var la,da,ca={},ua=function(t,e,i,s,r){var n=aa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===la&&(la=new oa,da=new oa),t.parentContainer?t.getWorldTransformMatrix(la,da):la.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),la.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ua(t,e,n,h,r)},va={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ea&&(ea={}),s=ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ta(s,0,0,-i.rotation),s}(t,e,this,!0);return ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return pa(this.parent,this,t,e,i)}};Object.assign(va,Qh);const ga=Phaser.Math.DegToRad,fa=Phaser.Math.RadToDeg,ma=Phaser.Utils.Objects.GetValue;class ya extends Kh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return fa(this._rotation)}set angle(t){this.rotation=ga(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ma(t,"width",void 0),i=ma(t,"height",void 0),s=ma(t,"scaleX",void 0),r=ma(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ya.prototype,va);const ba=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},xa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const wa=Phaser.Utils.Objects.GetValue;class Sa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=wa(t,"x",0),i=wa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(wa(t,"tl",void 0),e,i),s.tr=Pa(wa(t,"tr",void 0),e,i),s.bl=Pa(wa(t,"bl",void 0),e,i),s.br=Pa(wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ta(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ta(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ta(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ta(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Oa(t),t},Ta=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=wa(e,"x",0),t.y=wa(e,"y",0)),Oa(t)},Oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var ka=function(t){return!t.hasOwnProperty("convex")||t.convex},Ea=function(t){return t.x>0&&t.y>0},Ma=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,l,o,l,180,270,!1,h):Ma(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,l,o,l,270,360,!1,h):Ma(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,r-l,o,l,0,90,!1,h):Ma(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,r-l,o,l,90,180,!1,h):Ma(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Da=Phaser.Utils.Objects.GetValue;class La extends ya{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Da(e,"color",null),Da(e,"color2",null),Da(e,"horizontalGradient",!0)),this.setStroke(Da(e,"stroke",null),Da(e,"strokeThickness",2)),this.setCornerRadius(Da(e,"cornerRadius",0),Da(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,xa("color2",t,this),xa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,xa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ra(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const za=Phaser.Utils.Objects.GetValue;class Aa extends ya{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,za(t,"color2",null),za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Ya=Phaser.Utils.Objects.GetValue;class Xa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ya(t,"bold",!1)),this.setItalic(Ya(t,"italic",!1)),this.setFontSize(Ya(t,"fontSize","16px")),this.setFontFamily(Ya(t,"fontFamily","Courier")),this.setColor(Ya(t,"color","#fff")),this.setStrokeStyle(Ya(t,"stroke",null),Ya(t,"strokeThickness",0)),this.setShadow(Ya(t,"shadowColor",null),Ya(t,"shadowOffsetX",0),Ya(t,"shadowOffsetY",0),Ya(t,"shadowBlur",0)),this.setOffset(Ya(t,"offsetX",0),Ya(t,"offsetY",0)),this.setSpace(Ya(t,"leftSpace",0),Ya(t,"rightSpace",0)),this.setAlign(Ya(t,"align",void 0)),this.setBackgroundColor(Ya(t,"backgroundColor",null)),this.setBackgroundHeight(Ya(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ya(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(xa("stroke",t,this),xa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(xa("shadowOffsetX",t,this),xa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Xa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Fa=Phaser.Utils.Array.Remove,Ia=Phaser.Utils.Array.Remove,Wa="text",ja="image",Ba="drawer",Ha="space",Na="command";var Ua=function(t){return t.type===Wa&&"\n"===t.text},Ga=function(t){return t.type===Wa&&"\f"===t.text},Va=function(t){return t.type===Wa};class $a extends ya{constructor(t,e,i){super(t,Wa),this.updateTextFlag=!1,this.style=new Xa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ja=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Za extends ya{constructor(t,e,i){super(t,ja),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ka extends ya{constructor(t,e,i,s){super(t,Ba),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Qa extends ya{constructor(t,e){super(t,Ha),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class to extends Kh{constructor(t,e,i,s,r){super(t,Na),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function eo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>eo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=eo(t[i]));return e}var io=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const so={none:0,word:1,char:2,character:2,mix:3};var ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=oo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=oo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=co(t,"wrapMode");void 0===c&&(c=co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=so[c]);var u=co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=co(t,"letterSpacing",0),v=co(t,"hAlign",0),g=co(t,"vAlign",0),f=co(t,"justifyPercentage",.25),m=io({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=vo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=vo(t,"maxLines",0);var a=0===i,o=vo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=vo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=vo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=vo(t,"letterSpacing",0),p=vo(t,"rtl",!0),v=vo(t,"hAlign",p?2:0),g=vo(t,"vAlign",0),f=io({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return ke(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Fa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Wa);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Io=Phaser.Utils.Objects.GetFastValue;var Wo={};class jo{constructor(t){this.pools=Io(t,"pools",Wo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Fo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Jo(t,r,e,i,n),a=0;a<=Go&&0!==h;a++){if((r+=h)<0){r=0;break}h=Jo(t,r,e,i,n)}return a===Go&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zo=Phaser.Utils.Objects.GetValue,Ko=Phaser.Utils.Objects.GetValue;class Qo extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ko(e,"background",void 0),r=Ko(e,"icon",void 0),n=Ko(e,"iconMask",void 0),h=Ko(e,"text",void 0),a=Ko(e,"action",void 0),o=Ko(e,"actionMask",void 0),l=Ko(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ko(e,"space.icon",0),top:Ko(e,"space.iconTop",0),bottom:Ko(e,"space.iconBottom",0),left:Ko(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ko(e,"space.icon",0),left:Ko(e,"space.iconLeft",0),right:Ko(e,"space.iconRight",0),top:Ko(e,"space.iconTop",0)});var d=Ko(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Eh.call(this,r,r,1)),!d){var c=Ko(e,"iconSize",void 0);this.setIconSize(Ko(e,"iconWidth",c),Ko(e,"iconHeight",c))}}if(h){var u=Ko(e,"wrapText",!1),p=Ko(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Wh(h,u),e.expandTextWidth=!0,Uo(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zo(e,"minWidth",0),s=Zo(e,"minHeight",0),r=Zo(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Vo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Vo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ko(e,"space.text",0),m=Ko(e,"expandTextWidth",!1),y=Ko(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ko(e,"space.actionTop",0),bottom:Ko(e,"space.actionBottom",0),right:Ko(e,"space.actionRight",0)}:{left:Ko(e,"space.actionLeft",0),right:Ko(e,"space.actionRight",0),bottom:Ko(e,"space.actionBottom",0)},d=Ko(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Eh.call(this,a,a,1)),!d)){var b=Ko(e,"actionSize");this.setActionSize(Ko(e,"actionWidth",b),Ko(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}Phaser.Utils.Objects.GetValue;var tl=function({game:t,fileInput:e,closeDelay:i}){return ki(qe(t).events,"focus").then((function(){return void 0===(t=i)&&(t=0),new Promise((function(i,s){setTimeout((function(){i(e)}),t)}));var t,e})).then((function(){var t={files:e.files};return Promise.resolve(t)}))};Phaser.Utils.Objects.GetValue,Phaser.DOM.RemoveFromDOM;var el=function(t,e,i,s,r,n){if(null===r||!1===r);else if(Ks(r))r();else{var h=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e}return t=qe(t),"textures"===i?t.textures:t.cache[i]}(t,i,r);h.exists(s)&&h.remove(s)}var a=t.load;if(n&&a.once(`filecomplete-${i}-${s}`,(function(t,e,i){n(i)})),Ks(e))e();else{var o=window.URL.createObjectURL(e);a[i](s,o)}a.start()},il={loadFile:function(t,e,i,s,r){var n=this.scene;return el(n,t,e,i,s,r),this},loadFilePromise:function(t,e,i,s){var r=this.scene;return new Promise((function(n,h){el(r,t,e,i,s,(function(t){n(t)}))}))}};const sl=Phaser.GameObjects.DOMElement,rl=Phaser.Utils.Objects.IsPlainObject,nl=Phaser.Utils.Objects.GetValue;class hl extends sl{constructor(t,e,i,s,r,n){rl(e)?(e=nl(n=e,"x",0),i=nl(n,"y",0),s=nl(n,"width",0),r=nl(n,"height",0)):rl(s)&&(s=nl(n=s,"width",0),r=nl(n,"height",0));var h=document.createElement("input");h.type="file",h.style.display="none";var a=document.createElement("label");a.appendChild(h);var o=nl(n,"style",void 0);super(t,e,i,a,o),this.type="rexFileChooser",this.resetFromJSON(n),this.resize(s,r);var l=this;h.onchange=function(){l.emit("change",l)},this.setCloseDelay(nl(n,"closeDelay",200)),h.onclick=function(){tl({game:t,fileInput:h,closeDelay:l.closeDelay}).then((function(){l.emit("select",l)}))}}resetFromJSON(t){return this.setAccept(nl(t,"accept","")),this.setMultiple(nl(t,"multiple",!1)),this}setAccept(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}setMultiple(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}setCloseDelay(t){return void 0===t&&(t=200),this.closeDelay=t,this}get fileInput(){return this.node.children[0]}open(){return this.fileInput.click(),this}get files(){return this.fileInput.files}setOpenEnable(t){return void 0===t&&(t=!0),this.fileInput.disabled=!t,this}}var al={resize:function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width=`${t}px`,i.height=`${e}px`,this.updateSize(),this},syncTo:function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this}};Object.assign(hl.prototype,al,il);var ol={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const ll=Phaser.Utils.Objects.GetValue;class dl extends Qo{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new hl(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(ll(e,"accept","")),this.setMultiple(ll(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}return Object.assign(dl.prototype,ol),dl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfileselectorbutton=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ti={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Ai extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,h):s.resetFromJSON(h),s.restart(),s},Wi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Ls);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?As(e):t};class Xs extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=As(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Is extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Wi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Vs=function(t,e){Wi(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case Tn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Ne);var wn={};const Sn=0,Pn=1,Tn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const An="IDLE",Xn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),Fr.call(t,e),Br.call(t,e),Wn.call(t,e),Bn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l,d,c){pe.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=nh[e];else if(ih(e)){var v;e=sh(v=e,"proportion",void 0),i=sh(v,"align",rh),s=sh(v,"padding",0),r=sh(v,"expand",!1),n=sh(v,"key",void 0),h=sh(v,"index",void 0),t.isRexSizer||(a=sh(v,"minWidth",void 0),o=sh(v,"minHeight",void 0)),l=sh(v,"fitRatio",0),d=sh(v,"offsetX",0),c=sh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=kt.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(We(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){bh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends xh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Sh);var Th=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class _h extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=kh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Th.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Th.call(this,this.width,this.height,this.padding,t,e)),this}}const kh={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.GameObjects.Text;var Rh=function(t){return t instanceof Mh};const Dh=Phaser.GameObjects.BitmapText;var Lh=function(t){return t instanceof Dh},zh=/^[\x00-\x7F]+$/,Yh=function(t){return zh.test(t)},Ah=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Fh=2;const Ih={none:0,word:1,char:Fh,character:Fh,mix:3};var Wh=function(t,e){var i=function(t){return Lh(t)?2:Rh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Ih[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ah;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ih[e]||0),t.style.wrapMode=e}};const jh=Phaser.Renderer.WebGL.Utils;var Bh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=jh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Hh=Phaser.Display.Color;var Nh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Hh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Uh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Gh=Phaser.Display.Canvas.CanvasPool,Vh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class Jh extends Vh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Gh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Gh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Jh,[qh.Alpha,qh.BlendMode,qh.Crop,qh.Depth,qh.Flip,qh.GetBounds,qh.Mask,qh.Origin,qh.Pipeline,qh.PostPipeline,qh.ScrollFactor,qh.Tint,qh.Transform,qh.Visible,Bh,Nh,Uh]);var Zh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Kh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Kh.prototype,Zh);var Qh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ta=Phaser.Math.RotateAround;var ea;const ia=Phaser.Geom.Rectangle;var sa,ra=function(t){void 0===sa&&(sa=new ia);var e=t.drawTLX,i=t.drawTLY;return sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),sa};const na=Phaser.Math.RotateAround;var ha,aa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=e,s.y=i,0!==t.rotation&&na(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const oa=Phaser.GameObjects.Components.TransformMatrix;var la,da,ca={},ua=function(t,e,i,s,r){var n=aa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===la&&(la=new oa,da=new oa),t.parentContainer?t.getWorldTransformMatrix(la,da):la.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),la.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ua(t,e,n,h,r)},va={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ea&&(ea={}),s=ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ta(s,0,0,-i.rotation),s}(t,e,this,!0);return ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return pa(this.parent,this,t,e,i)}};Object.assign(va,Qh);const ga=Phaser.Math.DegToRad,fa=Phaser.Math.RadToDeg,ma=Phaser.Utils.Objects.GetValue;class ya extends Kh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return fa(this._rotation)}set angle(t){this.rotation=ga(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ma(t,"width",void 0),i=ma(t,"height",void 0),s=ma(t,"scaleX",void 0),r=ma(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ya.prototype,va);const ba=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},xa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const wa=Phaser.Utils.Objects.GetValue;class Sa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=wa(t,"x",0),i=wa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(wa(t,"tl",void 0),e,i),s.tr=Pa(wa(t,"tr",void 0),e,i),s.bl=Pa(wa(t,"bl",void 0),e,i),s.br=Pa(wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ta(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ta(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ta(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ta(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Oa(t),t},Ta=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=wa(e,"x",0),t.y=wa(e,"y",0)),Oa(t)},Oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var ka=function(t){return!t.hasOwnProperty("convex")||t.convex},Ea=function(t){return t.x>0&&t.y>0},Ma=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,l,o,l,180,270,!1,h):Ma(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,l,o,l,270,360,!1,h):Ma(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,r-l,o,l,0,90,!1,h):Ma(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,r-l,o,l,90,180,!1,h):Ma(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Da=Phaser.Utils.Objects.GetValue;class La extends ya{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Da(e,"color",null),Da(e,"color2",null),Da(e,"horizontalGradient",!0)),this.setStroke(Da(e,"stroke",null),Da(e,"strokeThickness",2)),this.setCornerRadius(Da(e,"cornerRadius",0),Da(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,xa("color2",t,this),xa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,xa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ra(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const za=Phaser.Utils.Objects.GetValue;class Ya extends ya{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,za(t,"color2",null),za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Aa=Phaser.Utils.Objects.GetValue;class Xa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Aa(t,"bold",!1)),this.setItalic(Aa(t,"italic",!1)),this.setFontSize(Aa(t,"fontSize","16px")),this.setFontFamily(Aa(t,"fontFamily","Courier")),this.setColor(Aa(t,"color","#fff")),this.setStrokeStyle(Aa(t,"stroke",null),Aa(t,"strokeThickness",0)),this.setShadow(Aa(t,"shadowColor",null),Aa(t,"shadowOffsetX",0),Aa(t,"shadowOffsetY",0),Aa(t,"shadowBlur",0)),this.setOffset(Aa(t,"offsetX",0),Aa(t,"offsetY",0)),this.setSpace(Aa(t,"leftSpace",0),Aa(t,"rightSpace",0)),this.setAlign(Aa(t,"align",void 0)),this.setBackgroundColor(Aa(t,"backgroundColor",null)),this.setBackgroundHeight(Aa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Aa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(xa("stroke",t,this),xa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(xa("shadowOffsetX",t,this),xa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Xa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Fa=Phaser.Utils.Array.Remove,Ia=Phaser.Utils.Array.Remove,Wa="text",ja="image",Ba="drawer",Ha="space",Na="command";var Ua=function(t){return t.type===Wa&&"\n"===t.text},Ga=function(t){return t.type===Wa&&"\f"===t.text},Va=function(t){return t.type===Wa};class $a extends ya{constructor(t,e,i){super(t,Wa),this.updateTextFlag=!1,this.style=new Xa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ja=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Za extends ya{constructor(t,e,i){super(t,ja),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ka extends ya{constructor(t,e,i,s){super(t,Ba),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Qa extends ya{constructor(t,e){super(t,Ha),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class to extends Kh{constructor(t,e,i,s,r){super(t,Na),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function eo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>eo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=eo(t[i]));return e}var io=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const so={none:0,word:1,char:2,character:2,mix:3};var ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=oo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=oo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=co(t,"wrapMode");void 0===c&&(c=co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=so[c]);var u=co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=co(t,"letterSpacing",0),v=co(t,"hAlign",0),g=co(t,"vAlign",0),f=co(t,"justifyPercentage",.25),m=io({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=vo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=vo(t,"maxLines",0);var a=0===i,o=vo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=vo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=vo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=vo(t,"letterSpacing",0),p=vo(t,"rtl",!0),v=vo(t,"hAlign",p?2:0),g=vo(t,"vAlign",0),f=io({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return ke(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Fa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Wa);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Io=Phaser.Utils.Objects.GetFastValue;var Wo={};class jo{constructor(t){this.pools=Io(t,"pools",Wo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Fo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Jo(t,r,e,i,n),a=0;a<=Go&&0!==h;a++){if((r+=h)<0){r=0;break}h=Jo(t,r,e,i,n)}return a===Go&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zo=Phaser.Utils.Objects.GetValue,Ko=Phaser.Utils.Objects.GetValue;class Qo extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ko(e,"background",void 0),r=Ko(e,"icon",void 0),n=Ko(e,"iconMask",void 0),h=Ko(e,"text",void 0),a=Ko(e,"action",void 0),o=Ko(e,"actionMask",void 0),l=Ko(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ko(e,"space.icon",0),top:Ko(e,"space.iconTop",0),bottom:Ko(e,"space.iconBottom",0),left:Ko(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ko(e,"space.icon",0),left:Ko(e,"space.iconLeft",0),right:Ko(e,"space.iconRight",0),top:Ko(e,"space.iconTop",0)});var d=Ko(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Eh.call(this,r,r,1)),!d){var c=Ko(e,"iconSize",void 0);this.setIconSize(Ko(e,"iconWidth",c),Ko(e,"iconHeight",c))}}if(h){var u=Ko(e,"wrapText",!1),p=Ko(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Wh(h,u),e.expandTextWidth=!0,Uo(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zo(e,"minWidth",0),s=Zo(e,"minHeight",0),r=Zo(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Vo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Vo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ko(e,"space.text",0),m=Ko(e,"expandTextWidth",!1),y=Ko(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ko(e,"space.actionTop",0),bottom:Ko(e,"space.actionBottom",0),right:Ko(e,"space.actionRight",0)}:{left:Ko(e,"space.actionLeft",0),right:Ko(e,"space.actionRight",0),bottom:Ko(e,"space.actionBottom",0)},d=Ko(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Eh.call(this,a,a,1)),!d)){var b=Ko(e,"actionSize");this.setActionSize(Ko(e,"actionWidth",b),Ko(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}Phaser.Utils.Objects.GetValue;var tl=function({game:t,fileInput:e,closeDelay:i}){return ki(qe(t).events,"focus").then((function(){return void 0===(t=i)&&(t=0),new Promise((function(i,s){setTimeout((function(){i(e)}),t)}));var t,e})).then((function(){var t={files:e.files};return Promise.resolve(t)}))};Phaser.Utils.Objects.GetValue,Phaser.DOM.RemoveFromDOM;var el=function(t,e,i,s,r,n){if(null===r||!1===r);else if(Ks(r))r();else{var h=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e}return t=qe(t),"textures"===i?t.textures:t.cache[i]}(t,i,r);h.exists(s)&&h.remove(s)}var a=t.load;if(n&&a.once(`filecomplete-${i}-${s}`,(function(t,e,i){n(i)})),Ks(e))e();else{var o=window.URL.createObjectURL(e);a[i](s,o)}a.start()},il={loadFile:function(t,e,i,s,r){var n=this.scene;return el(n,t,e,i,s,r),this},loadFilePromise:function(t,e,i,s){var r=this.scene;return new Promise((function(n,h){el(r,t,e,i,s,(function(t){n(t)}))}))}};const sl=Phaser.GameObjects.DOMElement,rl=Phaser.Utils.Objects.IsPlainObject,nl=Phaser.Utils.Objects.GetValue;class hl extends sl{constructor(t,e,i,s,r,n){rl(e)?(e=nl(n=e,"x",0),i=nl(n,"y",0),s=nl(n,"width",0),r=nl(n,"height",0)):rl(s)&&(s=nl(n=s,"width",0),r=nl(n,"height",0));var h=document.createElement("input");h.type="file",h.style.display="none";var a=document.createElement("label");a.appendChild(h);var o=nl(n,"style",void 0);super(t,e,i,a,o),this.type="rexFileChooser",this.resetFromJSON(n),this.resize(s,r);var l=this;h.onchange=function(){l.emit("change",l)},this.setCloseDelay(nl(n,"closeDelay",200)),h.onclick=function(){tl({game:t,fileInput:h,closeDelay:l.closeDelay}).then((function(){l.emit("select",l)}))}}resetFromJSON(t){return this.setAccept(nl(t,"accept","")),this.setMultiple(nl(t,"multiple",!1)),this}setAccept(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}setMultiple(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}setCloseDelay(t){return void 0===t&&(t=200),this.closeDelay=t,this}get fileInput(){return this.node.children[0]}open(){return this.fileInput.click(),this}get files(){return this.fileInput.files}setOpenEnable(t){return void 0===t&&(t=!0),this.fileInput.disabled=!t,this}}var al={resize:function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width=`${t}px`,i.height=`${e}px`,this.updateSize(),this},syncTo:function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this}};Object.assign(hl.prototype,al,il);var ol={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const ll=Phaser.Utils.Objects.GetValue;class dl extends Qo{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new hl(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(ll(e,"accept","")),this.setMultiple(ll(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}return Object.assign(dl.prototype,ol),dl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfileselectorbutton=e(); diff --git a/dist/rexfolder.js b/dist/rexfolder.js index b6afe14dbb..06afdf279c 100644 --- a/dist/rexfolder.js +++ b/dist/rexfolder.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$2(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$2(config, 'offsetX', 0); + offsetY = GetValue$2(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexfolder.min.js b/dist/rexfolder.min.js index f7946563af..4aa99fc273 100644 --- a/dist/rexfolder.min.js +++ b/dist/rexfolder.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const Pe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},_e={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var _s={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,_s,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Gs=function(t,e){Yi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},_r=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case En:this.tracerState=xn,this.onDrag1End();break;case Pn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const xn=0,En=1,Pn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},_n={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=_n),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ra[e];else if(ea(e)){var u;e=ia(u=e,"proportion",void 0),i=ia(u,"align",sa),s=ia(u,"padding",0),r=ia(u,"expand",!1),n=ia(u,"key",void 0),a=ia(u,"index",void 0),t.isRexSizer||(h=ia(u,"minWidth",void 0),o=ia(u,"minHeight",void 0)),l=ia(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);class Sa extends zs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xa={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ea=function(t,e){Ri.popUp.call(t,e,this.expandDirection)},Pa=function(t,e){Ri.scaleDown.call(t,e,this.expandDirection)},Ta={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ea.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Pa.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const wa=Phaser.Utils.Objects.GetValue;class Oa extends ba{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=wa(e,"space"),a=1===this.orientation?"left":"top",h=wa(e,"align.title",a),o=wa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:wa(n,"titleLeft",0),right:wa(n,"titleRight",0),top:wa(n,"titleTop",0),bottom:wa(n,"titleBottom",0)}});var l=wa(e,"toggleByTarget",void 0),d=wa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&gr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Sa(r),!wa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=wa(e,"align.child","left");var u=(o=wa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:wa(n,"childLeft",0),right:wa(n,"childRight",0),top:wa(n,"childTop",0),bottom:wa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(wa(p,"duration",200)),this.setExpandCallback(wa(p,"expandCallback",void 0)),this.setCollapseCallback(wa(p,"collapseCallback",void 0)),this.reLayoutTarget=wa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=wa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}return Object.assign(Oa.prototype,xa,Ta),Oa},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfolder=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const Pe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},we=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},_e={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return we(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return we(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},wi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return wi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Fi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),wi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var _s={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,_s,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ws(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Ys extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Ys{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Gs=function(t,e){Fi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Os{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Or={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},wr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},_r=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new Os(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Os(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new Os(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case En:this.tracerState=xn,this.onDrag1End();break;case Pn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const xn=0,En=1,Pn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const On=Phaser.Math.RotateAround;var wn=function(t,e,i,s){return On(t,e,i,s),t.rotation+=s,t},_n={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=_n),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Xn}break;case Xn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Xn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Xn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Xr.call(t,e),jr.call(t,e),Fn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ra[e];else if(ea(e)){var v;e=ia(v=e,"proportion",void 0),i=ia(v,"align",sa),s=ia(v,"padding",0),r=ia(v,"expand",!1),n=ia(v,"key",void 0),a=ia(v,"index",void 0),t.isRexSizer||(h=ia(v,"minWidth",void 0),o=ia(v,"minHeight",void 0)),l=ia(v,"fitRatio",0),d=ia(v,"offsetX",0),c=ia(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=wt.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);class Sa extends zs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xa={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ea=function(t,e){Ri.popUp.call(t,e,this.expandDirection)},Pa=function(t,e){Ri.scaleDown.call(t,e,this.expandDirection)},Ta={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ea.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Pa.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Oa=Phaser.Utils.Objects.GetValue;class wa extends ba{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Oa(e,"space"),a=1===this.orientation?"left":"top",h=Oa(e,"align.title",a),o=Oa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:Oa(n,"titleLeft",0),right:Oa(n,"titleRight",0),top:Oa(n,"titleTop",0),bottom:Oa(n,"titleBottom",0)}});var l=Oa(e,"toggleByTarget",void 0),d=Oa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&gr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Sa(r),!Oa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=Oa(e,"align.child","left");var u=(o=Oa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:Oa(n,"childLeft",0),right:Oa(n,"childRight",0),top:Oa(n,"childTop",0),bottom:Oa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Oa(p,"duration",200)),this.setExpandCallback(Oa(p,"expandCallback",void 0)),this.setCollapseCallback(Oa(p,"collapseCallback",void 0)),this.reLayoutTarget=Oa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Oa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}return Object.assign(wa.prototype,xa,Ta),wa},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexfolder=e(); diff --git a/dist/rexgameobjectshellplugin.js b/dist/rexgameobjectshellplugin.js index f5b28fd70e..e8893246de 100644 --- a/dist/rexgameobjectshellplugin.js +++ b/dist/rexgameobjectshellplugin.js @@ -17675,7 +17675,7 @@ var LayoutChildren$5 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -17701,8 +17701,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -17731,10 +17731,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -17744,14 +17744,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -17949,6 +17952,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -17974,6 +17978,9 @@ } fitRatio = GetValue$1J(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$1J(config, 'offsetX', 0); + offsetY = GetValue$1J(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -18014,12 +18021,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -39309,6 +39325,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexgameobjectshellplugin.min.js b/dist/rexgameobjectshellplugin.min.js index e8e969e429..d587207620 100644 --- a/dist/rexgameobjectshellplugin.min.js +++ b/dist/rexgameobjectshellplugin.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null,this.displayList=null,this.updateList=null}static register(e,i){t.prototype[e]=i}}var e={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const i=Phaser.Scene;var s=function(t){return t instanceof i},r=function(t){return null==t||"object"!=typeof t?null:s(t)?t:t.scene&&s(t.scene)?t.scene:t.parent&&t.parent.scene&&s(t.parent.scene)?t.parent.scene:null};const n=Phaser.Game;var a=function(t){return t instanceof n},o=function(t){return null==t||"object"!=typeof t?null:a(t)?t:a(t.game)?t.game:s(t)?t.sys.game:s(t.scene)?t.scene.sys.game:void 0};const h=Phaser.Utils.Objects.GetValue;class l{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(h(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=r(t),this.game=o(t),this}}Object.assign(l.prototype,e);const d=Phaser.Utils.Objects.GetValue;class c extends l{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(d(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=u[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const u={no:0,lazy:1,always:2};var p=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},v=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const g=Phaser.Geom.Rectangle,f=Phaser.Math.Vector2,m=Phaser.Math.RotateAround;var y=function(t,e){if(void 0===e?e=new g:!0===e&&(void 0===b&&(b=new g),e=b),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();x(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,C(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,w(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,S(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else x(t,e),i=e.x,s=e.y,C(t,e),r=e.x,n=e.y,w(t,e),a=e.x,o=e.y,S(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},b=void 0,x=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-v(t)*t.originY,P(t,e,i))},C=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getTopRight?t.getTopRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-v(t)*t.originY,P(t,e,i))},w=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-v(t)*t.originY+v(t),P(t,e,i))},S=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-v(t)*t.originY+v(t),P(t,e,i))},k=function(t,e,i){void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O);var s=p(t),r=v(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),P(t,e,i)},O=void 0,P=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&m(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e},T=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!y(t,!0).contains(e,i)||r&&!r(t,e,i))},_=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=M),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},M={},E=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?T(t,e.x,e.y,i,s):!!(r=_(e,n,!0))&&T(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=D,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===A&&this.onDragEnd(),this.pointer=void 0,this.tracerState=D,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=B,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&E(t,s,e,i)}}const D=0,A=1,B="IDLE";function j(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=q,this.state=J);break;case q:this.state=J}}onDragEnd(){this.state===J&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=q))}onDrag(){this.state!==Z&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Z)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===J){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Z):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=q:this.state=Z)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===q&&(this.state=Z)}get isTapped(){return this.state===q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Z="IDLE",J="BEGIN",q="RECOGNIZED",Q=Phaser.Utils.Objects.GetValue;class tt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=et},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Q(t,"threshold",9)),this.setHoldTime(Q(t,"time",251)),this}onDragStart(){this.state=it,0===this.holdTime&&(this.state=st)}onDragEnd(){this.state=et}onDrag(){this.state!==et&&this.pointer.getDistance()>this.dragThreshold&&(this.state=et)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===it&&t-this.pointer.downTime>=this.holdTime&&(this.state=st)}get isPressed(){return this.state===st}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const et="IDLE",it="BEGIN",st="RECOGNIZED",rt=Phaser.Utils.Objects.GetValue;class nt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=_(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=at},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rt(t,"threshold",10)),this}onDragStart(){this.state=ot,0===this.dragThreshold&&(this.state=ht)}onDragEnd(){this.state=at}onDrag(){switch(this.state){case ot:if(this.pointer.getDistance()>=this.dragThreshold){this.state=ht,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case ht:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=_(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===ht}setDragThreshold(t){return this.dragThreshold=t,this}}const at="IDLE",ot="BEGIN",ht="RECOGNIZED";var lt=function(t){return o(t).loop.delta};const dt=Phaser.Math.Distance.Between,ct=Phaser.Math.Angle.Between;var ut={getDt:function(){return lt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dt(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)}},pt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const gt=Phaser.Utils.Objects.GetValue,ft=Phaser.Math.RadToDeg;class mt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yt},eventEmitter:!1};this.setRecongizedStateObject(new U(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gt(t,"threshold",10)),this.setVelocityThreshold(gt(t,"velocityThreshold",1e3)),this.setDirectionMode(gt(t,"dir","8dir")),this}onDragStart(){this.state=bt}onDragEnd(){this.state=yt}onDrag(){this.state===bt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xt))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xt&&(this.state=yt)}get isSwiped(){return this.state===xt}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(ft(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mt.prototype,ut);const yt="IDLE",bt="BEGIN",xt="RECOGNIZED";var Ct=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const wt=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Ot=Phaser.Math.Angle.Between;class Pt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wt(e,"inputConfig",void 0)),this.setEventEmitter(wt(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wt(t,"enable",!0)),this.bounds=wt(t,"bounds",void 0),this.tracerState=_t,this.pointers.length=0,Ct(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ct(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _t:this.tracerState=Mt,this.onDrag1Start();break;case Mt:this.tracerState=Et,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],St(this.pointers,e),this.tracerState){case Mt:this.tracerState=_t,this.onDrag1End();break;case Et:this.tracerState=Mt,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mt:this.onDrag1();break;case Et:this.onDrag2()}}}dragCancel(){return this.tracerState===Et&&this.onDrag2End(),this.pointers.length=0,Ct(this.movedState),this.tracerState=_t,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return Ot(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tt.x=e.x-i.x,Tt.y=e.y-i.y}else Tt.x=0,Tt.y=0;return Tt}get centerX(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Et)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Et)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&E(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&E(t,s,e,i)}}Object.assign(Pt.prototype,e);var Tt={};const _t=0,Mt=1,Et=2,Rt="IDLE",Lt=Phaser.Utils.Objects.GetValue;class Dt extends Pt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=At},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Lt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Bt,0===this.dragThreshold&&(this.state=jt)}onDrag2End(){this.state=At}onDrag2(){switch(this.state){case Bt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=jt}break;case jt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===jt}setDragThreshold(t){return this.dragThreshold=t,this}}const At="IDLE",Bt="BEGIN",jt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Wt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Yt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Xt=Phaser.Math.Angle.ShortestBetween,Vt=Phaser.Math.RadToDeg,Gt=Phaser.Math.DegToRad;var Ht={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Vt(this.angleBetween));this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.state=$t}break;case $t:t=Ft(Vt(this.angleBetween)),this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$t}get rotation(){return Gt(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ht);const Ut="IDLE",Nt="BEGIN",$t="RECOGNIZED";var Kt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Zt=Phaser.Utils.Objects.GetValue;class Jt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Zt(e,"inputTarget",t),this.pan=new nt(this.inputTarget);var i=Kt(t,Zt(e,"camera"));this.setCamera(i).setEnable(Zt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const Qt=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class te extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Qt(e,"inputTarget",t),this.pinch=new Dt(this.inputTarget);var i=Kt(t,Qt(e,"camera"));this.setCamera(i).setEnable(Qt(e,"enable",!0)).setMinZoom(Qt(e,"minZoom",void 0)).setMaxZoom(Qt(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ee=Phaser.Input.Keyboard.Key,ie=Phaser.Input.Keyboard.KeyCodes,se=["up","down","left","right"];class re{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=se.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const ue=Phaser.Utils.Objects.GetValue;class pe extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ce(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Kt(t,ue(e,"camera"));this.setCamera(s).setEnable(ue(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class ge extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!fe(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),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)}}var fe=function(t){return"step"===t||"poststep"===t};const me=Phaser.Utils.Objects.GetValue,ye=Phaser.Math.Clamp;class be{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=me(t,"state",xe),this.timeScale=me(t,"timeScale",1),this.delay=me(t,"delay",0),this.repeat=me(t,"repeat",0),this.repeatCounter=me(t,"repeatCounter",0),this.repeatDelay=me(t,"repeatDelay",0),this.duration=me(t,"duration",0),this.nowTime=me(t,"nowTime",0),this.justRestart=me(t,"justRestart",!1)}toJSON(){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}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?we:Ce,this.repeatCounter=0,this}stop(){return this.state=xe,this}update(t,e){this.state!==xe&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Se)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=we))}get t(){var t;switch(this.state){case xe:case Ce:case Se:t=0;break;case we:t=this.nowTime/this.duration;break;case ke:t=1}return ye(t,0,1)}set t(t){(t=ye(t,-1,1))<0?(this.state=Ce,this.nowTime=-this.delay*t):(this.state=we,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xe}get isDelay(){return this.state===Ce}get isCountDown(){return this.state===we}get isRunning(){return this.state===Ce||this.state===we}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xe=0,Ce=1,we=2,Se=3,ke=-1;class Oe extends ge{constructor(t,e){super(t,e),this.timer=new be}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pe=Phaser.Utils.Objects.GetValue,Te=Phaser.Utils.Objects.GetAdvancedValue,_e=Phaser.Tweens.Builders.GetEaseFunction;class Me extends Oe{resetFromJSON(t){return this.timer.resetFromJSON(Pe(t,"timer")),this.setEnable(Pe(t,"enable",!0)),this.setTarget(Pe(t,"target",this.parent)),this.setDelay(Te(t,"delay",0)),this.setDuration(Te(t,"duration",1e3)),this.setEase(Pe(t,"ease","Linear")),this.setRepeat(Pe(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_e(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ee=Phaser.Math.Linear;class Re extends Me{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Ee(this.startZoomValue,this.endZoomValue,e.t);qt(t,s,i.focusLocalX,i.focusLocalY)}}const Le=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class De extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Re(this);var i=Kt(t,Le(e,"camera"));this.setEnable(Le(e,"enable",!0)).setMinZoom(Le(e,"minZoom")).setMaxZoom(Le(e,"maxZoom")).setZoomStep(Le(e,"zoomStep",.1)).setEaseDuration(Le(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Ae(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=Be(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Ae=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},Be=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function je(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>je(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=je(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class We extends l{constructor(t,e){super(t,e=void 0===e?{}:je(e)),this._enable=!0,this._camera=void 0;var i=ze(e,"enable",!0),s=ze(e,"minZoom"),r=ze(e,"maxZoom");ze(e,"panScroll",!0)&&(this.panScroll=new Jt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new te(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"pinchZoomEnable",!0),minZoom:ze(e,"pinchZoomMin",s),maxZoom:ze(e,"pinchZoomMax",r)})),ze(e,"boundsScroll",!0)&&(this.boundsScroll=new pe(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new De(t,{camera:ze(e,"camera"),enable:ze(e,"mouseWheelZoomEnable",!0),zoomStep:ze(e,"mouseWheelZoomStep",.1),minZoom:ze(e,"mouseWheelZoomMin",s),maxZoom:ze(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Ye=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Ge(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return He(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iJe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eJe(t).x,getChildLocalY:t=>Je(t).y};const pi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=Je(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=Je(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return Je(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Je(t).rotation=pi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Je(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Je(t).rotation},gi={updateChildScale(t){var e=Je(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=Je(t),i=e.parent;return e.scaleX=ci(t.scaleX,i.scaleX),e.scaleY=ci(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=Je(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=Je(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Je(t).scaleX,getChildLocalScaleY:t=>Je(t).scaleY},fi={updateChildVisible(t){var e=Je(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=Je(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),Je(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Je(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Je(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Je(t).visible},mi={updateChildAlpha(t){var e=Je(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=Je(t),i=e.parent;return e.alpha=ci(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Je(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Je(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Je(t).alpha},yi={updateChildActive(t){var e=Je(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return Je(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),Je(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Je(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Je(t).active},bi={updateChildScrollFactor(t){var e=Je(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},xi={updateCameraFilter(t){var e=Je(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ci={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},wi=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Oi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ti=Phaser.Utils.Array;var _i={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const As=Phaser.GameObjects.Rectangle;let Bs=class extends As{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ds(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new Bs(this.scene,t,e);return this.scene.add.existing(i),i})),Ye(window,"RexPlugins.GameObjectShell.FullWindowRectangle",Bs);var js={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},zs={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ws={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,js,zs,Ws);var Ys=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Xs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Vs=function(t){return t>>16&255},Gs=function(t){return t>>8&255},Hs=function(t){return 255&t};const Us=Phaser.Events.EventEmitter;var Ns=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=$s),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},$s={},Ks=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Ns),function(t){if(t.events)return t;var e=new Us,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Zs=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Js=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(er(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},dr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Kt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},cr={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Zi(i,t,e)})),this}};Object.assign(cr,Xs,sr,rr,nr,ar,or,lr,dr);const ur=Phaser.Utils.Objects.GetValue;class pr{constructor(t,e){this.scene=t,this.BobClass=ur(e,"BobClass",Is),this.setCreateGameObjectCallback(ur(e,"createGameObject"),ur(e,"createGameObjectScope")),this.setEventEmitter(ur(e,"eventEmitter",void 0)),this.setGameObjectDepth(ur(e,"depth",void 0));var i=ur(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(ur(i,"mode")),this.setGOFadeTime(ur(i,"time",500)));var s=ur(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(ur(e,"enable",!0)),this.setViewport(ur(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=ur(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(ur(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=ur(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=he(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Ys(this.bobs)&&0===this.removedGOs.length}}Object.assign(pr.prototype,e,cr);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),wi(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const xn=Phaser.Utils.Objects.GetValue;var Cn=function(t,e){return void 0===e?t:t[e]},wn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=xn(e,"left",0),t.right=xn(e,"right",0),t.top=xn(e,"top",0),t.bottom=xn(e,"bottom",0)),t},Sn={getInnerPadding(t){return Cn(this.space,t)},setInnerPadding(t,e){return wn(this.space,t,e),this},getOuterPadding(t){return Cn(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return wn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Cn(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),wn(this.getSizerConfig(t).padding,e,i),this}},kn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},On=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Pn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Tn=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},En={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Rn=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Fa={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xa={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Er),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Er),this.transitOutCallback=t,this}},Va={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ga={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ha={};Object.assign(Ha,Fa,Xa,Va,Ga);const Ua=Phaser.Utils.Objects.GetValue;class Na extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ua(e,"duration.in",200)),this.setTransitOutTime(Ua(e,"duration.out",200)),this.setTransitInCallback(Ua(e,"transitIn")),this.setTransitOutCallback(Ua(e,"transitOut")),this.oneShotMode=Ua(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ya(this,{eventEmitter:!1,initState:Ua(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Na.prototype,Ha);const $a=Phaser.Utils.Objects.GetValue;class Ka extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($a(t,"hitAreaMode",0)),this.setEnable($a(t,"enable",!0)),this.setStopMode($a(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Za[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Za={default:0,fullWindow:1};const Ja=Phaser.Utils.Objects.GetValue;class qa extends Bs{constructor(t,e){super(t,Ja(e,"color",0),Ja(e,"alpha",.8)),this.touchEventStop=new Ka(this,{hitAreaMode:1})}}var Qa={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Un(t,e)},scaleDown(t,e){Nn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e)},fadeOut(t,e){aa(t,e,!1)}},to=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e,t.alpha)},eo=function(t,e){aa(t,e,!1)};const io=Phaser.Utils.Objects.GetValue;let so=class extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ro.popUp),null==e.transitOut&&(e.transitOut=ro.scaleDown),e.destroy=io(e,"destroy",!0),super(t,e);var i=io(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qa(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(io(i,"transitIn",to)),this.setCoverTransitOutCallback(io(i,"transitOut",eo)));var s=io(e,"touchOutsideClose",!1),r=io(e,"duration.hold",-1),n=io(e,"timeOutClose",r>=0),a=io(e,"anyTouchClose",!1);io(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),io(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&T(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.popUp:t=Qa.popUp;break;case ro.fadeIn:t=Qa.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.scaleDown:t=Qa.scaleDown;break;case ro.fadeOut:t=Qa.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ro={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var no={modal(t,e){return Cs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new so(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ao=function(t,e,i,s,r){Cs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},oo={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ao.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ao.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ao.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ao.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ao.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ao.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ao.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ao.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ao.call(this,"shutdown",t,e,i,s),this}},ho=function(t){return"[object Array]"===Object.prototype.toString.call(t)},lo=function(t,e,i,s,r){return T(t,e,i,uo(s),r)},co=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},uo=function(t){return t?function(e,i,s){return!!co(e)&&(t(e,i,s),!0)}:co},po={},vo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=po),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},go=function(t,e,i,s,r,n,a,o){tn(t,e,i,s,r,n),void 0!==a&&(t.x+=a),void 0!==o&&(t.y+=o),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const fo=Phaser.Display.Align.CENTER,mo=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue;class bo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(yo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(yo(t,"enable",!0)),this.setMode(yo(t,"mode",1)),this.setClickInterval(yo(t,"clickInterval",100)),this.setDragThreshold(yo(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xo={press:0,pointerdown:0,release:1,pointerup:1};var Co={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new bo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wo=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!So(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return ko.length=0,!0;return ko.length=0,!1},ko=[];const Oo=Phaser.Utils.Objects.GetValue;class Po extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=Oo(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Oo(t,"enable",!0)),this.setMode(Oo(t,"mode",1)),this.setClickInterval(Oo(t,"clickInterval",100)),this.setDragThreshold(Oo(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=To[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wo:E)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const To={press:0,pointerdown:0,release:1,pointerup:1};var _o={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Po(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mo extends U{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Eo=Phaser.Utils.Objects.GetValue;class Ro extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mo,this.parent.setInteractive(Eo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Eo(t,"enable",!0)),this.setCooldown(Eo(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&E(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ro(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ro(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Do={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ao=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,a,o,h,l){ln.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=vh[e];else if(ch(e)){var u;e=uh(u=e,"proportion",void 0),i=uh(u,"align",ph),s=uh(u,"padding",0),r=uh(u,"expand",!1),n=uh(u,"key",void 0),a=uh(u,"index",void 0),t.isRexSizer||(o=uh(u,"minWidth",void 0),h=uh(u,"minHeight",void 0)),l=uh(u,"fitRatio",0)}return"string"==typeof i&&(i=Mr[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/v(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=on(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?v(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const mh=is.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Mr[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Sh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Oh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(An(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Rn.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=c,y=u,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Tn.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||On.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Pn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||_n.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),Mn.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Oh,fh,xh,Ch,wh,Sh,kh);var Ph=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,a){Mh(e)?(e=Eh(a=e,"x",0),i=Eh(a,"y",0),s=Eh(a,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(s)?(s=Eh(a=s,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(n)&&(n=Eh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Eh(a,"space.item",0)),this.setStartChildIndex(Eh(a,"startChildIndex",0)),this.setRTL(Eh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ph.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Oh);var Lh=function(t,e,i,s){return e/t<=i?e/(s-1):0},Dh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=Ah(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Ah(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const jh=Phaser.Utils.Objects.IsPlainObject,zh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER;var Ih=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ln.call(this,t),jh(e)&&(e=zh(r=e,"padding",0),i=zh(r,"key",void 0),s=zh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Wh,r.padding=on(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Yh={add(t,e,i){if(ho(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Vh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},ml=0,yl=1,bl=2,xl=0,Cl=1,wl=2,Sl=/(?:\r\n|\r|\n)/;const kl={none:xl,word:Cl,char:wl,character:wl,mix:3},Ol=Phaser.Renderer.WebGL.Utils;var Pl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Ol.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Tl=Phaser.Display.Color;var _l={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+o;return this.context.drawImage(d.source.image,p,v,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Tl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Ml=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},El={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ml(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Xe();const Rl=Phaser.Display.Canvas.CanvasPool,Ll=Phaser.GameObjects.GameObject,Dl=Phaser.Utils.String.UUID;let Al=class extends Ll{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Rl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Dl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Rl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Bl=Phaser.GameObjects.Components;Phaser.Class.mixin(Al,[Bl.Alpha,Bl.BlendMode,Bl.Crop,Bl.Depth,Bl.Flip,Bl.GetBounds,Bl.Mask,Bl.Origin,Bl.Pipeline,Bl.PostPipeline,Bl.ScrollFactor,Bl.Tint,Bl.Transform,Bl.Visible,Pl,_l,El]);var jl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Ct(this.data),this}};class zl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(zl.prototype,jl);var Wl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Il=Phaser.Math.RotateAround;var Yl;const Fl=Phaser.Geom.Rectangle;var Xl,Vl=function(t){void 0===Xl&&(Xl=new Fl);var e=t.drawTLX,i=t.drawTLY;return Xl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Xl};const Gl=Phaser.Math.RotateAround;var Hl,Ul=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hl&&(Hl={}),s=Hl),s.x=e,s.y=i,0!==t.rotation&&Gl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Nl=Phaser.GameObjects.Components.TransformMatrix;var $l,Kl,Zl={},Jl=function(t,e,i,s,r){var n=Ul(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Zl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===$l&&($l=new Nl,Kl=new Nl),t.parentContainer?t.getWorldTransformMatrix($l,Kl):$l.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),$l.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ql=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Jl(t,e,n,a,r)},Ql={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Yl&&(Yl={}),s=Yl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Il(s,0,0,-i.rotation),s}(t,e,this,!0);return Vl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ql(this.parent,this,t,e,i)}};Object.assign(Ql,Wl);const td=Phaser.Math.DegToRad,ed=Phaser.Math.RadToDeg,id=Phaser.Utils.Objects.GetValue;class sd extends zl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ed(this._rotation)}set angle(t){this.rotation=td(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=id(t,"width",void 0),i=id(t,"height",void 0),s=id(t,"scaleX",void 0),r=id(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(sd.prototype,Ql);const rd=Phaser.Utils.String.Pad;var nd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${rd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ad=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const od=Phaser.Utils.Objects.GetValue;let hd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=od(t,"x",0),i=od(t,"y",0));var s=this.cornerRadius;s.tl=ld(od(t,"tl",void 0),e,i),s.tr=ld(od(t,"tr",void 0),e,i),s.bl=ld(od(t,"bl",void 0),e,i),s.br=ld(od(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){dd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){dd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){dd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){dd(this.cornerRadius.br,t)}};var ld=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),cd(t),t},dd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=od(e,"x",0),t.y=od(e,"y",0)),cd(t)},cd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const ud=Phaser.Math.DegToRad;var pd=function(t){return!t.hasOwnProperty("convex")||t.convex},vd=function(t){return t.x>0&&t.y>0},gd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,l,h,l,180,270,!1,a):gd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,l,h,l,270,360,!1,a):gd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,r-l,h,l,0,90,!1,a):gd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,r-l,h,l,90,180,!1,a):gd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},md=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),fd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const yd=Phaser.Utils.Objects.GetValue;class bd extends sd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(yd(e,"color",null),yd(e,"color2",null),yd(e,"horizontalGradient",!0)),this.setStroke(yd(e,"stroke",null),yd(e,"strokeThickness",2)),this.setCornerRadius(yd(e,"cornerRadius",0),yd(e,"cornerIteration",null))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ad("color2",t,this),ad("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ad("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){md(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const xd=Phaser.Utils.Objects.GetValue;class Cd extends sd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(xd(e,"color",null),xd(e,"color2",null),xd(e,"horizontalGradient",!0)),this.setStroke(xd(e,"stroke",null),xd(e,"strokeThickness",2))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,xd(t,"color2",null),xd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const wd=Phaser.Utils.Objects.GetValue;let Sd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(wd(t,"bold",!1)),this.setItalic(wd(t,"italic",!1)),this.setFontSize(wd(t,"fontSize","16px")),this.setFontFamily(wd(t,"fontFamily","Courier")),this.setColor(wd(t,"color","#fff")),this.setStrokeStyle(wd(t,"stroke",null),wd(t,"strokeThickness",0)),this.setShadow(wd(t,"shadowColor",null),wd(t,"shadowOffsetX",0),wd(t,"shadowOffsetY",0),wd(t,"shadowBlur",0)),this.setOffset(wd(t,"offsetX",0),wd(t,"offsetY",0)),this.setSpace(wd(t,"leftSpace",0),wd(t,"rightSpace",0)),this.setAlign(wd(t,"align",void 0)),this.setBackgroundColor(wd(t,"backgroundColor",null)),this.setBackgroundHeight(wd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(wd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ad("stroke",t,this),ad("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ad("shadowOffsetX",t,this),ad("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=nd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=nd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=nd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=nd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const kd=Phaser.Utils.Array.Remove,Od=Phaser.Utils.Array.Remove,Pd="text",Td="image",_d="drawer",Md="space",Ed="command";var Rd=function(t){return t.type===Pd&&"\n"===t.text},Ld=function(t){return t.type===Pd&&"\f"===t.text},Dd=function(t){return t.type===Pd};class Ad extends sd{constructor(t,e,i){super(t,Pd),this.updateTextFlag=!1,this.style=new Sd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Bd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const jd=Phaser.Display.Canvas.CanvasPool;var zd=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=jd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),jd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Wd extends sd{constructor(t,e,i){super(t,Td),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){zd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Id extends sd{constructor(t,e,i,s){super(t,_d),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Yd extends sd{constructor(t,e){super(t,Md),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Fd extends zl{constructor(t,e,i,s,r){super(t,Ed),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Xd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Vd={none:0,word:1,char:2,character:2,mix:3};var Gd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=$d.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=$d.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Zd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Zd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Zd(t,"wrapMode");void 0===c&&(c=Zd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Vd[c]);var u=Zd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Zd(t,"letterSpacing",0),v=Zd(t,"hAlign",0),g=Zd(t,"vAlign",0),f=Zd(t,"justifyPercentage",.25),m=Xd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Qd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qd(t,"maxLines",0);var o=0===i,h=Qd(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Qd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Qd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qd(t,"letterSpacing",0),p=Qd(t,"rtl",!0),v=Qd(t,"hAlign",p?2:0),g=Qd(t,"vAlign",0),f=Xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return wn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Cn(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),kd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Od(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Pd);return null===i?i=new Ad(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ql(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const kc=Phaser.Utils.Objects.GetFastValue;var Oc={};class Pc{constructor(t){this.pools=kc(t,"pools",Oc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Ac(t,r,e,i,n),o=0;o<=Rc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ac(t,r,e,i,n)}return o===Rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(t,e,i),t},Dc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ac=function(t,e,i,s,r){var n,a=Dc(t,e,r),o=Dc(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Bc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const jc=Phaser.Utils.Objects.GetValue,zc=Phaser.Utils.Objects.GetValue;class Wc extends el{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=zc(e,"background",void 0),r=zc(e,"icon",void 0),n=zc(e,"iconMask",void 0),a=zc(e,"text",void 0),o=zc(e,"action",void 0),h=zc(e,"actionMask",void 0),l=zc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:zc(e,"space.icon",0),top:zc(e,"space.iconTop",0),bottom:zc(e,"space.iconBottom",0),left:zc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:zc(e,"space.icon",0),left:zc(e,"space.iconLeft",0),right:zc(e,"space.iconRight",0),top:zc(e,"space.iconTop",0)});var d=zc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=ol.call(this,r,r,1)),!d){var c=zc(e,"iconSize",void 0);this.setIconSize(zc(e,"iconWidth",c),zc(e,"iconHeight",c))}}if(a){var u=zc(e,"wrapText",!1),p=zc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ul(t)){case 0:switch("string"==typeof e&&(e=kl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=gl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=kl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Ec(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=jc(e,"minWidth",0),s=jc(e,"minHeight",0),r=jc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Lc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Lc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=zc(e,"space.text",0),m=zc(e,"expandTextWidth",!1),y=zc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,o&&(i={right:f}),g=y):(v=y?1:0,o&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(o&&(i=0===this.orientation?{top:zc(e,"space.actionTop",0),bottom:zc(e,"space.actionBottom",0),right:zc(e,"space.actionRight",0)}:{left:zc(e,"space.actionLeft",0),right:zc(e,"space.actionRight",0),bottom:zc(e,"space.actionBottom",0)},d=zc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=ol.call(this,o,o,1)),!d)){var b=zc(e,"actionSize");this.setActionSize(zc(e,"actionWidth",b),zc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Ic=Phaser.Renderer.WebGL.Utils,Yc=function(t,e,i,s,r,n){for(var a=Ic.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},Hc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Uc=Phaser.Renderer.Canvas.SetTransform;var Nc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Yc(r,a,e,l,o,h),e.isStroked&&Xc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Uc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Kc.prototype,Nc);var Zc=function(t){return t.x>0&&t.y>0},Jc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const qc=Phaser.Math.DegToRad;var Qc=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=tp(t,"tl",0),this.radiusTR=tp(t,"tr",0),this.radiusBL=tp(t,"bl",0),this.radiusBR=tp(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Qc(e,e,e,e,180,270,!1,r,t):Qc(0,0,e,e,90,0,!0,r,t):Jc(0,0,t),(e=this.radiusTR)>0?this._convexTR?Qc(i-e,e,e,e,270,360,!1,r,t):Qc(i,0,e,e,180,90,!0,r,t):Jc(i,0,t),(e=this.radiusBR)>0?this._convexBR?Qc(i-e,s-e,e,e,0,90,!1,r,t):Qc(i,s,e,e,270,180,!0,r,t):Jc(i,s,t),(e=this.radiusBL)>0?this._convexBL?Qc(e,s-e,e,e,90,180,!1,r,t):Qc(0,s,e,e,360,270,!0,r,t):Jc(0,s,t),t.push(t[0],t[1]),zu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ip=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject;class np extends(Tu(bu)){constructor(t,e,i,s,r,n,a,o){rp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):rp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):rp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Qu).setName("trackFill")).addShape((new Qu).setName("bar")).addShape((new Qu).setName("trackStroke")),this.setTrackColor(sp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sp(o,"trackStrokeThickness",2),sp(o,"trackStrokeColor",void 0)),this.setSkewX(sp(o,"skewX",0)),this.setRTL(sp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ap={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ip(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ip(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&ip(o,0,0,e,i,t)}};Object.assign(np.prototype,ap);class op extends np{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ye(e,"easeValue.duration",e.easeDuration),Ye(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=hp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const hp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(op.prototype,cu);let lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const dp=Phaser.GameObjects.NineSlice,cp=Phaser.Utils.Objects.GetValue;class up extends dp{constructor(t,e){void 0===e&&(e={}),super(t,cp(e,"x",0),cp(e,"y",0),cp(e,"key",null),cp(e,"frame",null),cp(e,"width",0),cp(e,"height",0),cp(e,"leftWidth",0),cp(e,"rightWidth",0),cp(e,"topHeight",0),cp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=cp(e,"effects",!0);i&&er(this,i),this.style=new lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(up.prototype,cu);let pp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const vp=Phaser.GameObjects.Image,gp=Phaser.Utils.Objects.GetValue;class fp extends vp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",""),gp(e,"frame",void 0)),this.type="rexStatesImage";var i=gp(e,"effects",!0);i&&er(this,i),this.style=new pp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fp.prototype,cu);var mp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const yp=Phaser.Utils.Objects.IsPlainObject,bp=Phaser.Utils.Objects.GetValue;var xp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const Cp={scale:0,repeat:1};var wp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Sp={_beginDraw:Er,_drawImage:Er,_drawTileSprite:Er,_endDraw:Er,setGetFrameNameCallback:function(t){return void 0===t&&(t=mp),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=je(i),s=je(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:g,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*h;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return yp(t)?(this.stretchMode.edge=xp(bp(t,"edge",0)),this.stretchMode.internal=xp(bp(t,"internal",0))):(t=xp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return wp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const kp=Phaser.Utils.Objects.IsPlainObject,Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.GameObjects;var Tp=void 0,_p=function(t,e){if(Tp||(Tp={},o(t).events.once("destroy",(function(){for(var t in Tp)Tp[t].destroy();Tp=void 0}))),!Tp.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Pp[e](i)).setOrigin(0),Tp[e]=t}return Tp[e]};const Mp=Phaser.GameObjects.RenderTexture;class Ep extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(kp(i)?(i=Op(d=i,"x",0),s=Op(d,"y",0),r=Op(d,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(r)?(r=Op(d=r,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(a)?(a=Op(d=a,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(o)?(o=Op(d=o,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Op(d,"baseFrame",void 0)):kp(h)&&(h=Op(d=h,"columns",void 0),l=Op(d,"rows",void 0)),void 0===o&&(o=Op(d,"frame",void 0)),void 0===h){var c=Op(d,"leftWidth",void 0),u=Op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Op(d,"topHeight",void 0),v=Op(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Op(d,"getFrameNameCallback",void 0)),this.setStretchMode(Op(d,"stretchMode",0)),this.setPreserveRatio(Op(d,"preserveRatio",!0));var g=Op(d,"maxFixedPartScale",1),f=Op(d,"maxFixedPartScaleX",g),m=Op(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Sp),i}(Mp,"rexNinePatch")){}var Rp={_drawImage:function(t,e,i,s,r,n){var a=_p(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=_p(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ep.prototype,Rp);let Lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Dp=Phaser.Utils.Objects.GetValue;class Ap extends Ep{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Dp(e,"effects",!0);i&&er(this,i),this.style=new Lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ap.prototype,cu);const Bp=["alpha","tint","flipX","flipY"];var jp=function(t,e){if(!e)return t;for(var i=0,s=Bp.length;i0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=D,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===A&&this.onDragEnd(),this.pointer=void 0,this.tracerState=D,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=B,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&E(t,s,e,i)}}const D=0,A=1,B="IDLE";function j(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=q,this.state=J);break;case q:this.state=J}}onDragEnd(){this.state===J&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=q))}onDrag(){this.state!==Z&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Z)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===J){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Z):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=q:this.state=Z)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===q&&(this.state=Z)}get isTapped(){return this.state===q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Z="IDLE",J="BEGIN",q="RECOGNIZED",Q=Phaser.Utils.Objects.GetValue;class tt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=et},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Q(t,"threshold",9)),this.setHoldTime(Q(t,"time",251)),this}onDragStart(){this.state=it,0===this.holdTime&&(this.state=st)}onDragEnd(){this.state=et}onDrag(){this.state!==et&&this.pointer.getDistance()>this.dragThreshold&&(this.state=et)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===it&&t-this.pointer.downTime>=this.holdTime&&(this.state=st)}get isPressed(){return this.state===st}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const et="IDLE",it="BEGIN",st="RECOGNIZED",rt=Phaser.Utils.Objects.GetValue;class nt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=_(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=at},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rt(t,"threshold",10)),this}onDragStart(){this.state=ot,0===this.dragThreshold&&(this.state=ht)}onDragEnd(){this.state=at}onDrag(){switch(this.state){case ot:if(this.pointer.getDistance()>=this.dragThreshold){this.state=ht,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case ht:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=_(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===ht}setDragThreshold(t){return this.dragThreshold=t,this}}const at="IDLE",ot="BEGIN",ht="RECOGNIZED";var lt=function(t){return o(t).loop.delta};const dt=Phaser.Math.Distance.Between,ct=Phaser.Math.Angle.Between;var ut={getDt:function(){return lt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dt(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)}},pt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const gt=Phaser.Utils.Objects.GetValue,ft=Phaser.Math.RadToDeg;class mt extends L{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yt},eventEmitter:!1};this.setRecongizedStateObject(new U(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gt(t,"threshold",10)),this.setVelocityThreshold(gt(t,"velocityThreshold",1e3)),this.setDirectionMode(gt(t,"dir","8dir")),this}onDragStart(){this.state=bt}onDragEnd(){this.state=yt}onDrag(){this.state===bt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xt))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xt&&(this.state=yt)}get isSwiped(){return this.state===xt}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(ft(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mt.prototype,ut);const yt="IDLE",bt="BEGIN",xt="RECOGNIZED";var Ct=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const wt=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Ot=Phaser.Math.Angle.Between;class Pt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wt(e,"inputConfig",void 0)),this.setEventEmitter(wt(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wt(t,"enable",!0)),this.bounds=wt(t,"bounds",void 0),this.tracerState=_t,this.pointers.length=0,Ct(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ct(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _t:this.tracerState=Mt,this.onDrag1Start();break;case Mt:this.tracerState=Et,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],St(this.pointers,e),this.tracerState){case Mt:this.tracerState=_t,this.onDrag1End();break;case Et:this.tracerState=Mt,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mt:this.onDrag1();break;case Et:this.onDrag2()}}}dragCancel(){return this.tracerState===Et&&this.onDrag2End(),this.pointers.length=0,Ct(this.movedState),this.tracerState=_t,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return Ot(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tt.x=e.x-i.x,Tt.y=e.y-i.y}else Tt.x=0,Tt.y=0;return Tt}get centerX(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Et)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Et)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&E(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&E(t,s,e,i)}}Object.assign(Pt.prototype,e);var Tt={};const _t=0,Mt=1,Et=2,Rt="IDLE",Lt=Phaser.Utils.Objects.GetValue;class Dt extends Pt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=At},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Lt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Bt,0===this.dragThreshold&&(this.state=jt)}onDrag2End(){this.state=At}onDrag2(){switch(this.state){case Bt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=jt}break;case jt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===jt}setDragThreshold(t){return this.dragThreshold=t,this}}const At="IDLE",Bt="BEGIN",jt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Wt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Yt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Xt=Phaser.Math.Angle.ShortestBetween,Vt=Phaser.Math.RadToDeg,Gt=Phaser.Math.DegToRad;var Ht={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Vt(this.angleBetween));this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.state=$t}break;case $t:t=Ft(Vt(this.angleBetween)),this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$t}get rotation(){return Gt(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ht);const Ut="IDLE",Nt="BEGIN",$t="RECOGNIZED";var Kt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Zt=Phaser.Utils.Objects.GetValue;class Jt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Zt(e,"inputTarget",t),this.pan=new nt(this.inputTarget);var i=Kt(t,Zt(e,"camera"));this.setCamera(i).setEnable(Zt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const Qt=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class te extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Qt(e,"inputTarget",t),this.pinch=new Dt(this.inputTarget);var i=Kt(t,Qt(e,"camera"));this.setCamera(i).setEnable(Qt(e,"enable",!0)).setMinZoom(Qt(e,"minZoom",void 0)).setMaxZoom(Qt(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ee=Phaser.Input.Keyboard.Key,ie=Phaser.Input.Keyboard.KeyCodes,se=["up","down","left","right"];class re{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=se.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const ue=Phaser.Utils.Objects.GetValue;class pe extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ce(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Kt(t,ue(e,"camera"));this.setCamera(s).setEnable(ue(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class ge extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!fe(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),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)}}var fe=function(t){return"step"===t||"poststep"===t};const me=Phaser.Utils.Objects.GetValue,ye=Phaser.Math.Clamp;class be{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=me(t,"state",xe),this.timeScale=me(t,"timeScale",1),this.delay=me(t,"delay",0),this.repeat=me(t,"repeat",0),this.repeatCounter=me(t,"repeatCounter",0),this.repeatDelay=me(t,"repeatDelay",0),this.duration=me(t,"duration",0),this.nowTime=me(t,"nowTime",0),this.justRestart=me(t,"justRestart",!1)}toJSON(){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}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?we:Ce,this.repeatCounter=0,this}stop(){return this.state=xe,this}update(t,e){this.state!==xe&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Se)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=we))}get t(){var t;switch(this.state){case xe:case Ce:case Se:t=0;break;case we:t=this.nowTime/this.duration;break;case ke:t=1}return ye(t,0,1)}set t(t){(t=ye(t,-1,1))<0?(this.state=Ce,this.nowTime=-this.delay*t):(this.state=we,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xe}get isDelay(){return this.state===Ce}get isCountDown(){return this.state===we}get isRunning(){return this.state===Ce||this.state===we}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xe=0,Ce=1,we=2,Se=3,ke=-1;class Oe extends ge{constructor(t,e){super(t,e),this.timer=new be}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pe=Phaser.Utils.Objects.GetValue,Te=Phaser.Utils.Objects.GetAdvancedValue,_e=Phaser.Tweens.Builders.GetEaseFunction;class Me extends Oe{resetFromJSON(t){return this.timer.resetFromJSON(Pe(t,"timer")),this.setEnable(Pe(t,"enable",!0)),this.setTarget(Pe(t,"target",this.parent)),this.setDelay(Te(t,"delay",0)),this.setDuration(Te(t,"duration",1e3)),this.setEase(Pe(t,"ease","Linear")),this.setRepeat(Pe(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_e(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ee=Phaser.Math.Linear;class Re extends Me{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Ee(this.startZoomValue,this.endZoomValue,e.t);qt(t,s,i.focusLocalX,i.focusLocalY)}}const Le=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class De extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Re(this);var i=Kt(t,Le(e,"camera"));this.setEnable(Le(e,"enable",!0)).setMinZoom(Le(e,"minZoom")).setMaxZoom(Le(e,"maxZoom")).setZoomStep(Le(e,"zoomStep",.1)).setEaseDuration(Le(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Ae(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=Be(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Ae=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},Be=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function je(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>je(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=je(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class We extends l{constructor(t,e){super(t,e=void 0===e?{}:je(e)),this._enable=!0,this._camera=void 0;var i=ze(e,"enable",!0),s=ze(e,"minZoom"),r=ze(e,"maxZoom");ze(e,"panScroll",!0)&&(this.panScroll=new Jt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new te(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"pinchZoomEnable",!0),minZoom:ze(e,"pinchZoomMin",s),maxZoom:ze(e,"pinchZoomMax",r)})),ze(e,"boundsScroll",!0)&&(this.boundsScroll=new pe(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new De(t,{camera:ze(e,"camera"),enable:ze(e,"mouseWheelZoomEnable",!0),zoomStep:ze(e,"mouseWheelZoomStep",.1),minZoom:ze(e,"mouseWheelZoomMin",s),maxZoom:ze(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Ye=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Ge(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return He(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iJe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eJe(t).x,getChildLocalY:t=>Je(t).y};const pi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=Je(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=Je(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return Je(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Je(t).rotation=pi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Je(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Je(t).rotation},gi={updateChildScale(t){var e=Je(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=Je(t),i=e.parent;return e.scaleX=ci(t.scaleX,i.scaleX),e.scaleY=ci(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=Je(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=Je(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Je(t).scaleX,getChildLocalScaleY:t=>Je(t).scaleY},fi={updateChildVisible(t){var e=Je(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=Je(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),Je(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Je(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Je(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Je(t).visible},mi={updateChildAlpha(t){var e=Je(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=Je(t),i=e.parent;return e.alpha=ci(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Je(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Je(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Je(t).alpha},yi={updateChildActive(t){var e=Je(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return Je(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),Je(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Je(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Je(t).active},bi={updateChildScrollFactor(t){var e=Je(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},xi={updateCameraFilter(t){var e=Je(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ci={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},wi=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Oi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ti=Phaser.Utils.Array;var _i={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const As=Phaser.GameObjects.Rectangle;let Bs=class extends As{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ds(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new Bs(this.scene,t,e);return this.scene.add.existing(i),i})),Ye(window,"RexPlugins.GameObjectShell.FullWindowRectangle",Bs);var js={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},zs={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ws={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,js,zs,Ws);var Ys=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Xs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Vs=function(t){return t>>16&255},Gs=function(t){return t>>8&255},Hs=function(t){return 255&t};const Us=Phaser.Events.EventEmitter;var Ns=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=$s),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},$s={},Ks=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Ns),function(t){if(t.events)return t;var e=new Us,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Zs=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Js=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(er(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},dr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Kt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},cr={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Zi(i,t,e)})),this}};Object.assign(cr,Xs,sr,rr,nr,ar,or,lr,dr);const ur=Phaser.Utils.Objects.GetValue;class pr{constructor(t,e){this.scene=t,this.BobClass=ur(e,"BobClass",Is),this.setCreateGameObjectCallback(ur(e,"createGameObject"),ur(e,"createGameObjectScope")),this.setEventEmitter(ur(e,"eventEmitter",void 0)),this.setGameObjectDepth(ur(e,"depth",void 0));var i=ur(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(ur(i,"mode")),this.setGOFadeTime(ur(i,"time",500)));var s=ur(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(ur(e,"enable",!0)),this.setViewport(ur(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=ur(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(ur(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=ur(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=he(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Ys(this.bobs)&&0===this.removedGOs.length}}Object.assign(pr.prototype,e,cr);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),wi(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const xn=Phaser.Utils.Objects.GetValue;var Cn=function(t,e){return void 0===e?t:t[e]},wn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=xn(e,"left",0),t.right=xn(e,"right",0),t.top=xn(e,"top",0),t.bottom=xn(e,"bottom",0)),t},Sn={getInnerPadding(t){return Cn(this.space,t)},setInnerPadding(t,e){return wn(this.space,t,e),this},getOuterPadding(t){return Cn(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return wn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Cn(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),wn(this.getSizerConfig(t).padding,e,i),this}},kn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},On=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Pn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Tn=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},En={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Rn=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Fa={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xa={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Er),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Er),this.transitOutCallback=t,this}},Va={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ga={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ha={};Object.assign(Ha,Fa,Xa,Va,Ga);const Ua=Phaser.Utils.Objects.GetValue;class Na extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ua(e,"duration.in",200)),this.setTransitOutTime(Ua(e,"duration.out",200)),this.setTransitInCallback(Ua(e,"transitIn")),this.setTransitOutCallback(Ua(e,"transitOut")),this.oneShotMode=Ua(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ya(this,{eventEmitter:!1,initState:Ua(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Na.prototype,Ha);const $a=Phaser.Utils.Objects.GetValue;class Ka extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($a(t,"hitAreaMode",0)),this.setEnable($a(t,"enable",!0)),this.setStopMode($a(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Za[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Za={default:0,fullWindow:1};const Ja=Phaser.Utils.Objects.GetValue;class qa extends Bs{constructor(t,e){super(t,Ja(e,"color",0),Ja(e,"alpha",.8)),this.touchEventStop=new Ka(this,{hitAreaMode:1})}}var Qa={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Un(t,e)},scaleDown(t,e){Nn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e)},fadeOut(t,e){aa(t,e,!1)}},to=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e,t.alpha)},eo=function(t,e){aa(t,e,!1)};const io=Phaser.Utils.Objects.GetValue;let so=class extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ro.popUp),null==e.transitOut&&(e.transitOut=ro.scaleDown),e.destroy=io(e,"destroy",!0),super(t,e);var i=io(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qa(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(io(i,"transitIn",to)),this.setCoverTransitOutCallback(io(i,"transitOut",eo)));var s=io(e,"touchOutsideClose",!1),r=io(e,"duration.hold",-1),n=io(e,"timeOutClose",r>=0),a=io(e,"anyTouchClose",!1);io(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),io(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&T(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.popUp:t=Qa.popUp;break;case ro.fadeIn:t=Qa.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.scaleDown:t=Qa.scaleDown;break;case ro.fadeOut:t=Qa.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ro={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var no={modal(t,e){return Cs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new so(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ao=function(t,e,i,s,r){Cs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},oo={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ao.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ao.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ao.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ao.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ao.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ao.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ao.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ao.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ao.call(this,"shutdown",t,e,i,s),this}},ho=function(t){return"[object Array]"===Object.prototype.toString.call(t)},lo=function(t,e,i,s,r){return T(t,e,i,uo(s),r)},co=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},uo=function(t){return t?function(e,i,s){return!!co(e)&&(t(e,i,s),!0)}:co},po={},vo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=po),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},go=function(t,e,i,s,r,n,a,o){tn(t,e,i,s,r,n),void 0!==a&&(t.x+=a),void 0!==o&&(t.y+=o),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const fo=Phaser.Display.Align.CENTER,mo=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue;class bo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(yo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(yo(t,"enable",!0)),this.setMode(yo(t,"mode",1)),this.setClickInterval(yo(t,"clickInterval",100)),this.setDragThreshold(yo(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xo={press:0,pointerdown:0,release:1,pointerup:1};var Co={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new bo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wo=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!So(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return ko.length=0,!0;return ko.length=0,!1},ko=[];const Oo=Phaser.Utils.Objects.GetValue;class Po extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=Oo(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Oo(t,"enable",!0)),this.setMode(Oo(t,"mode",1)),this.setClickInterval(Oo(t,"clickInterval",100)),this.setDragThreshold(Oo(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=To[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wo:E)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const To={press:0,pointerdown:0,release:1,pointerup:1};var _o={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Po(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mo extends U{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Eo=Phaser.Utils.Objects.GetValue;class Ro extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mo,this.parent.setInteractive(Eo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Eo(t,"enable",!0)),this.setCooldown(Eo(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&E(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ro(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ro(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Do={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ao=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,a,o,h,l,d,c){ln.call(this,t);var u=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),a=uh(f,"index",void 0),t.isRexSizer||(o=uh(f,"minWidth",void 0),h=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0)}return"string"==typeof i&&(i=Mr[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/v(t)),void 0===d&&(d=0),void 0===c&&(c=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=on(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?v(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const mh=is.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Mr[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Sh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Oh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(An(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Rn.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=c,y=u,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Tn.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||On.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Pn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||_n.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),Mn.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Oh,fh,xh,Ch,wh,Sh,kh);var Ph=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,a){Mh(e)?(e=Eh(a=e,"x",0),i=Eh(a,"y",0),s=Eh(a,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(s)?(s=Eh(a=s,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(n)&&(n=Eh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Eh(a,"space.item",0)),this.setStartChildIndex(Eh(a,"startChildIndex",0)),this.setRTL(Eh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ph.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Oh);var Lh=function(t,e,i,s){return e/t<=i?e/(s-1):0},Dh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=Ah(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Ah(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const jh=Phaser.Utils.Objects.IsPlainObject,zh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER;var Ih=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ln.call(this,t),jh(e)&&(e=zh(r=e,"padding",0),i=zh(r,"key",void 0),s=zh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Wh,r.padding=on(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Yh={add(t,e,i){if(ho(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Vh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},ml=0,yl=1,bl=2,xl=0,Cl=1,wl=2,Sl=/(?:\r\n|\r|\n)/;const kl={none:xl,word:Cl,char:wl,character:wl,mix:3},Ol=Phaser.Renderer.WebGL.Utils;var Pl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Ol.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Tl=Phaser.Display.Color;var _l={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+o;return this.context.drawImage(d.source.image,p,v,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Tl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Ml=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},El={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ml(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Xe();const Rl=Phaser.Display.Canvas.CanvasPool,Ll=Phaser.GameObjects.GameObject,Dl=Phaser.Utils.String.UUID;let Al=class extends Ll{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Rl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Dl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Rl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Bl=Phaser.GameObjects.Components;Phaser.Class.mixin(Al,[Bl.Alpha,Bl.BlendMode,Bl.Crop,Bl.Depth,Bl.Flip,Bl.GetBounds,Bl.Mask,Bl.Origin,Bl.Pipeline,Bl.PostPipeline,Bl.ScrollFactor,Bl.Tint,Bl.Transform,Bl.Visible,Pl,_l,El]);var jl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Ct(this.data),this}};class zl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(zl.prototype,jl);var Wl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Il=Phaser.Math.RotateAround;var Yl;const Fl=Phaser.Geom.Rectangle;var Xl,Vl=function(t){void 0===Xl&&(Xl=new Fl);var e=t.drawTLX,i=t.drawTLY;return Xl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Xl};const Gl=Phaser.Math.RotateAround;var Hl,Ul=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hl&&(Hl={}),s=Hl),s.x=e,s.y=i,0!==t.rotation&&Gl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Nl=Phaser.GameObjects.Components.TransformMatrix;var $l,Kl,Zl={},Jl=function(t,e,i,s,r){var n=Ul(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Zl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===$l&&($l=new Nl,Kl=new Nl),t.parentContainer?t.getWorldTransformMatrix($l,Kl):$l.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),$l.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ql=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Jl(t,e,n,a,r)},Ql={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Yl&&(Yl={}),s=Yl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Il(s,0,0,-i.rotation),s}(t,e,this,!0);return Vl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ql(this.parent,this,t,e,i)}};Object.assign(Ql,Wl);const td=Phaser.Math.DegToRad,ed=Phaser.Math.RadToDeg,id=Phaser.Utils.Objects.GetValue;class sd extends zl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ed(this._rotation)}set angle(t){this.rotation=td(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=id(t,"width",void 0),i=id(t,"height",void 0),s=id(t,"scaleX",void 0),r=id(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(sd.prototype,Ql);const rd=Phaser.Utils.String.Pad;var nd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${rd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ad=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const od=Phaser.Utils.Objects.GetValue;let hd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=od(t,"x",0),i=od(t,"y",0));var s=this.cornerRadius;s.tl=ld(od(t,"tl",void 0),e,i),s.tr=ld(od(t,"tr",void 0),e,i),s.bl=ld(od(t,"bl",void 0),e,i),s.br=ld(od(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){dd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){dd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){dd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){dd(this.cornerRadius.br,t)}};var ld=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),cd(t),t},dd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=od(e,"x",0),t.y=od(e,"y",0)),cd(t)},cd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const ud=Phaser.Math.DegToRad;var pd=function(t){return!t.hasOwnProperty("convex")||t.convex},vd=function(t){return t.x>0&&t.y>0},gd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,l,h,l,180,270,!1,a):gd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,l,h,l,270,360,!1,a):gd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,r-l,h,l,0,90,!1,a):gd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,r-l,h,l,90,180,!1,a):gd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},md=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),fd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const yd=Phaser.Utils.Objects.GetValue;class bd extends sd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(yd(e,"color",null),yd(e,"color2",null),yd(e,"horizontalGradient",!0)),this.setStroke(yd(e,"stroke",null),yd(e,"strokeThickness",2)),this.setCornerRadius(yd(e,"cornerRadius",0),yd(e,"cornerIteration",null))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ad("color2",t,this),ad("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ad("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){md(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const xd=Phaser.Utils.Objects.GetValue;class Cd extends sd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(xd(e,"color",null),xd(e,"color2",null),xd(e,"horizontalGradient",!0)),this.setStroke(xd(e,"stroke",null),xd(e,"strokeThickness",2))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,xd(t,"color2",null),xd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const wd=Phaser.Utils.Objects.GetValue;let Sd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(wd(t,"bold",!1)),this.setItalic(wd(t,"italic",!1)),this.setFontSize(wd(t,"fontSize","16px")),this.setFontFamily(wd(t,"fontFamily","Courier")),this.setColor(wd(t,"color","#fff")),this.setStrokeStyle(wd(t,"stroke",null),wd(t,"strokeThickness",0)),this.setShadow(wd(t,"shadowColor",null),wd(t,"shadowOffsetX",0),wd(t,"shadowOffsetY",0),wd(t,"shadowBlur",0)),this.setOffset(wd(t,"offsetX",0),wd(t,"offsetY",0)),this.setSpace(wd(t,"leftSpace",0),wd(t,"rightSpace",0)),this.setAlign(wd(t,"align",void 0)),this.setBackgroundColor(wd(t,"backgroundColor",null)),this.setBackgroundHeight(wd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(wd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ad("stroke",t,this),ad("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ad("shadowOffsetX",t,this),ad("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=nd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=nd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=nd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=nd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const kd=Phaser.Utils.Array.Remove,Od=Phaser.Utils.Array.Remove,Pd="text",Td="image",_d="drawer",Md="space",Ed="command";var Rd=function(t){return t.type===Pd&&"\n"===t.text},Ld=function(t){return t.type===Pd&&"\f"===t.text},Dd=function(t){return t.type===Pd};class Ad extends sd{constructor(t,e,i){super(t,Pd),this.updateTextFlag=!1,this.style=new Sd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Bd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const jd=Phaser.Display.Canvas.CanvasPool;var zd=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=jd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),jd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Wd extends sd{constructor(t,e,i){super(t,Td),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){zd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Id extends sd{constructor(t,e,i,s){super(t,_d),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Yd extends sd{constructor(t,e){super(t,Md),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Fd extends zl{constructor(t,e,i,s,r){super(t,Ed),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Xd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Vd={none:0,word:1,char:2,character:2,mix:3};var Gd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=$d.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=$d.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Zd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Zd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Zd(t,"wrapMode");void 0===c&&(c=Zd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Vd[c]);var u=Zd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Zd(t,"letterSpacing",0),v=Zd(t,"hAlign",0),g=Zd(t,"vAlign",0),f=Zd(t,"justifyPercentage",.25),m=Xd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Qd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qd(t,"maxLines",0);var o=0===i,h=Qd(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Qd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Qd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qd(t,"letterSpacing",0),p=Qd(t,"rtl",!0),v=Qd(t,"hAlign",p?2:0),g=Qd(t,"vAlign",0),f=Xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return wn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Cn(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),kd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Od(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Pd);return null===i?i=new Ad(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ql(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const kc=Phaser.Utils.Objects.GetFastValue;var Oc={};class Pc{constructor(t){this.pools=kc(t,"pools",Oc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Ac(t,r,e,i,n),o=0;o<=Rc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ac(t,r,e,i,n)}return o===Rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(t,e,i),t},Dc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ac=function(t,e,i,s,r){var n,a=Dc(t,e,r),o=Dc(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Bc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const jc=Phaser.Utils.Objects.GetValue,zc=Phaser.Utils.Objects.GetValue;class Wc extends el{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=zc(e,"background",void 0),r=zc(e,"icon",void 0),n=zc(e,"iconMask",void 0),a=zc(e,"text",void 0),o=zc(e,"action",void 0),h=zc(e,"actionMask",void 0),l=zc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:zc(e,"space.icon",0),top:zc(e,"space.iconTop",0),bottom:zc(e,"space.iconBottom",0),left:zc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:zc(e,"space.icon",0),left:zc(e,"space.iconLeft",0),right:zc(e,"space.iconRight",0),top:zc(e,"space.iconTop",0)});var d=zc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=ol.call(this,r,r,1)),!d){var c=zc(e,"iconSize",void 0);this.setIconSize(zc(e,"iconWidth",c),zc(e,"iconHeight",c))}}if(a){var u=zc(e,"wrapText",!1),p=zc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ul(t)){case 0:switch("string"==typeof e&&(e=kl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=gl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=kl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Ec(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=jc(e,"minWidth",0),s=jc(e,"minHeight",0),r=jc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Lc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Lc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=zc(e,"space.text",0),m=zc(e,"expandTextWidth",!1),y=zc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,o&&(i={right:f}),g=y):(v=y?1:0,o&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(o&&(i=0===this.orientation?{top:zc(e,"space.actionTop",0),bottom:zc(e,"space.actionBottom",0),right:zc(e,"space.actionRight",0)}:{left:zc(e,"space.actionLeft",0),right:zc(e,"space.actionRight",0),bottom:zc(e,"space.actionBottom",0)},d=zc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=ol.call(this,o,o,1)),!d)){var b=zc(e,"actionSize");this.setActionSize(zc(e,"actionWidth",b),zc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Ic=Phaser.Renderer.WebGL.Utils,Yc=function(t,e,i,s,r,n){for(var a=Ic.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},Hc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Uc=Phaser.Renderer.Canvas.SetTransform;var Nc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Yc(r,a,e,l,o,h),e.isStroked&&Xc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Uc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Kc.prototype,Nc);var Zc=function(t){return t.x>0&&t.y>0},Jc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const qc=Phaser.Math.DegToRad;var Qc=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=tp(t,"tl",0),this.radiusTR=tp(t,"tr",0),this.radiusBL=tp(t,"bl",0),this.radiusBR=tp(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Qc(e,e,e,e,180,270,!1,r,t):Qc(0,0,e,e,90,0,!0,r,t):Jc(0,0,t),(e=this.radiusTR)>0?this._convexTR?Qc(i-e,e,e,e,270,360,!1,r,t):Qc(i,0,e,e,180,90,!0,r,t):Jc(i,0,t),(e=this.radiusBR)>0?this._convexBR?Qc(i-e,s-e,e,e,0,90,!1,r,t):Qc(i,s,e,e,270,180,!0,r,t):Jc(i,s,t),(e=this.radiusBL)>0?this._convexBL?Qc(e,s-e,e,e,90,180,!1,r,t):Qc(0,s,e,e,360,270,!0,r,t):Jc(0,s,t),t.push(t[0],t[1]),zu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ip=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject;class np extends(Tu(bu)){constructor(t,e,i,s,r,n,a,o){rp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):rp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):rp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Qu).setName("trackFill")).addShape((new Qu).setName("bar")).addShape((new Qu).setName("trackStroke")),this.setTrackColor(sp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sp(o,"trackStrokeThickness",2),sp(o,"trackStrokeColor",void 0)),this.setSkewX(sp(o,"skewX",0)),this.setRTL(sp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ap={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ip(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ip(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&ip(o,0,0,e,i,t)}};Object.assign(np.prototype,ap);class op extends np{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ye(e,"easeValue.duration",e.easeDuration),Ye(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=hp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const hp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(op.prototype,cu);let lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const dp=Phaser.GameObjects.NineSlice,cp=Phaser.Utils.Objects.GetValue;class up extends dp{constructor(t,e){void 0===e&&(e={}),super(t,cp(e,"x",0),cp(e,"y",0),cp(e,"key",null),cp(e,"frame",null),cp(e,"width",0),cp(e,"height",0),cp(e,"leftWidth",0),cp(e,"rightWidth",0),cp(e,"topHeight",0),cp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=cp(e,"effects",!0);i&&er(this,i),this.style=new lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(up.prototype,cu);let pp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const vp=Phaser.GameObjects.Image,gp=Phaser.Utils.Objects.GetValue;class fp extends vp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",""),gp(e,"frame",void 0)),this.type="rexStatesImage";var i=gp(e,"effects",!0);i&&er(this,i),this.style=new pp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fp.prototype,cu);var mp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const yp=Phaser.Utils.Objects.IsPlainObject,bp=Phaser.Utils.Objects.GetValue;var xp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const Cp={scale:0,repeat:1};var wp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Sp={_beginDraw:Er,_drawImage:Er,_drawTileSprite:Er,_endDraw:Er,setGetFrameNameCallback:function(t){return void 0===t&&(t=mp),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=je(i),s=je(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:g,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*h;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return yp(t)?(this.stretchMode.edge=xp(bp(t,"edge",0)),this.stretchMode.internal=xp(bp(t,"internal",0))):(t=xp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return wp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const kp=Phaser.Utils.Objects.IsPlainObject,Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.GameObjects;var Tp=void 0,_p=function(t,e){if(Tp||(Tp={},o(t).events.once("destroy",(function(){for(var t in Tp)Tp[t].destroy();Tp=void 0}))),!Tp.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Pp[e](i)).setOrigin(0),Tp[e]=t}return Tp[e]};const Mp=Phaser.GameObjects.RenderTexture;class Ep extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(kp(i)?(i=Op(d=i,"x",0),s=Op(d,"y",0),r=Op(d,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(r)?(r=Op(d=r,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(a)?(a=Op(d=a,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(o)?(o=Op(d=o,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Op(d,"baseFrame",void 0)):kp(h)&&(h=Op(d=h,"columns",void 0),l=Op(d,"rows",void 0)),void 0===o&&(o=Op(d,"frame",void 0)),void 0===h){var c=Op(d,"leftWidth",void 0),u=Op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Op(d,"topHeight",void 0),v=Op(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Op(d,"getFrameNameCallback",void 0)),this.setStretchMode(Op(d,"stretchMode",0)),this.setPreserveRatio(Op(d,"preserveRatio",!0));var g=Op(d,"maxFixedPartScale",1),f=Op(d,"maxFixedPartScaleX",g),m=Op(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Sp),i}(Mp,"rexNinePatch")){}var Rp={_drawImage:function(t,e,i,s,r,n){var a=_p(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=_p(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ep.prototype,Rp);let Lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Dp=Phaser.Utils.Objects.GetValue;class Ap extends Ep{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Dp(e,"effects",!0);i&&er(this,i),this.style=new Lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ap.prototype,cu);const Bp=["alpha","tint","flipX","flipY"];var jp=function(t,e){if(!e)return t;for(var i=0,s=Bp.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexgridtable.js b/dist/rexgridtable.js index 90d29bf68b..3cb78fe45c 100644 --- a/dist/rexgridtable.js +++ b/dist/rexgridtable.js @@ -12192,7 +12192,7 @@ var LayoutChildren$1 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$w(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$w(config, 'offsetX', 0); + offsetY = GetValue$w(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexgridtable.min.js b/dist/rexgridtable.min.js index 542ce51cb4..95b2f76612 100644 --- a/dist/rexgridtable.min.js +++ b/dist/rexgridtable.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},X={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var V={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=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};const Oe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let _i=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ri),Xi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Hi),Bi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Ms,Ds,Rs,Xs);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ls);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?As(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=As(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Ws extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Fs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Sr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?br:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Es{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=fn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",bn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Pn.prototype,Ne);var xn={};const _n=0,On=1,Tn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Xn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const In="IDLE",jn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Xr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Bn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Et.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,b=0,y=d.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,lh,ph,vh,gh,fh,mh);var yh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=yh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var xh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},_h=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Oh(t));var i=t[e];return"string"==typeof i&&(i=xh[i]),i},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Th=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue,Dh=Phaser.Display.Align.CENTER;var Rh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},zh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Nh.prototype,Wh);const Gh=Phaser.Utils.Objects.GetValue;var Uh=Phaser.Renderer.WebGL.Utils,$h=function(t,e,i,s,r,n){for(var h=Uh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Qh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ta=Phaser.Renderer.Canvas.SetTransform;var ea={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&$h(r,h,e,l,a,o),e.isStroked&&qh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ta(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(sa.prototype,ea);const ra=Phaser.Utils.Objects.GetValue;let na=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ra(t,"x",0),i=ra(t,"y",0));var s=this.cornerRadius;s.tl=ha(ra(t,"tl",void 0),e,i),s.tr=ha(ra(t,"tr",void 0),e,i),s.bl=ha(ra(t,"bl",void 0),e,i),s.br=ha(ra(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){aa(this.cornerRadius.br,t)}};var ha=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oa(t),t},aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ra(e,"x",0),t.y=ra(e,"y",0)),oa(t)},oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},la=function(t){return t.x>0&&t.y>0},da=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ca=Phaser.Math.DegToRad;var ua=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const vo=Phaser.Utils.Objects.GetValue,go=Phaser.Utils.Objects.IsPlainObject;class fo extends(ja(Da)){constructor(t,e,i,s,r,n,h,a){go(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):go(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):go(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new uo).setName("trackFill")).addShape((new uo).setName("bar")).addShape((new uo).setName("trackStroke")),this.setTrackColor(vo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vo(a,"trackStrokeThickness",2),vo(a,"trackStrokeColor",void 0)),this.setSkewX(vo(a,"skewX",0)),this.setRTL(vo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var mo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&po(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),po(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&po(a,0,0,e,i,t)}};Object.assign(fo.prototype,mo);var bo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(bo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(bo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nAo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ao(t[i]));return e}const Io=Phaser.Utils.Objects.IsPlainObject,jo=Phaser.Utils.Objects.GetValue;var Wo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ho={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=zo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Ao(i),s=Ao(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var P=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return Io(t)?(this.stretchMode.edge=Wo(jo(t,"edge",0)),this.stretchMode.internal=Wo(jo(t,"internal",0))):(t=Wo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Go=Phaser.GameObjects;var Uo=void 0,$o=function(t,e){if(Uo||(Uo={},Ke(t).events.once("destroy",(function(){for(var t in Uo)Uo[t].destroy();Uo=void 0}))),!Uo.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Go[e](i)).setOrigin(0),Uo[e]=t}return Uo[e]};const Jo=Phaser.GameObjects.RenderTexture;class qo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ho),i}(Jo,"rexNinePatch")){}var Ko={_drawImage:function(t,e,i,s,r,n){var h=$o(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=$o(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(qo.prototype,Ko);class Zo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(wo(t,e))return t[e];var i=t.parent;return wo(i,e)?i[e]:void 0}set(t,e,i){return wo(t,e)?t[e]=i:wo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Qo=Phaser.Utils.Objects.GetValue;class tl extends qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Qo(e,"effects",!0);i&&To(this,i),this.style=new Zo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(tl.prototype,Pa);const el=["alpha","tint","flipX","flipY"];var il=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Co(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tl(t,e):new Do(t,e);break;default:s=new xa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=el.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const zl=Phaser.Utils.Objects.GetValue;class Al{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(zl(t,"value",0)),this.setSpeed(zl(t,"speed",0)),this.setAcceleration(zl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Il{constructor(){this.value,this.dir,this.movement=new Al}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Nl=Phaser.Utils.Objects.GetValue;var Gl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Nl(s,l,void 0):Nl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Dl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Nl(r,"position",0);"string"==typeof p&&(p=Ul[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Nl(s,"scrollDetectionMode");"string"==typeof y&&(y=$l[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,_,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==y&&(O.focus=1===y?2:0),S=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",x=`scroll${i}`):(w="t",x="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),b&&(a?(P=`childO${i}`,x=`scroll${i}`):(P="childOY",x="scroll"),b.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const Ul={right:0,left:1,bottom:0,top:1},$l={gameObject:0,rectBounds:1},Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jl(e,"width"),h=Jl(e,"height");n||Jl(e,"child.expandWidth",!0)||(s[1]=0),h||Jl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Gh(i,"child"),r=Gh(s,"gameObject",void 0);if(r){var n=Gh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),a.left=Gh(n,"left",0),a.right=Gh(n,"right",0);break;case 1:h.top=Gh(n,"left",0),h.bottom=Gh(n,"right",0),a.top=Gh(n,"top",0),a.bottom=Gh(n,"bottom",0);break;default:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),h.left=Gh(n,"left",0),h.right=Gh(n,"right",0)}e.add(r,{column:1,row:1,align:Gh(s,"align","center"),padding:a,expand:{width:Gh(s,"expandWidth",!0),height:Gh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Gl(t,a,"y",e);break;case 1:Gl(t,a,"x",e);break;default:Gl(t,a,"y",e),Gl(t,a,"x",e)}return a},Kl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Zl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Ql=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ad=Phaser.Utils.Objects.GetValue,od=Phaser.Utils.Array.SpliceOne;class ld{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new hd,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=ad(t,"cellHeight",60),i=ad(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(ad(t,"cellsCount",0)),this.setColumnCount(ad(t,"columns",1)),this}destroy(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}get defaultCellHeightMode(){return 0===this.nonZeroDeltaHeightCount}setDefaultCellHeight(t){return this.defaultCellHeight=t,this}setDefaultCellWidth(t){return this.defaultCellWidth=t,this}initCells(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var h=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=Md(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},X={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var V={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=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};const Oe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ae={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let _i=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ri),Xi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ai(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ai&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Hi),Bi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Ms,Ds,Rs,Xs);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ls);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?As(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=As(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Ws extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Fs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Sr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?br:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Es{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=fn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",bn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Pn.prototype,Ne);var xn={};const _n=0,On=1,Tn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Xn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const In="IDLE",jn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Xr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Bn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Et.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,b=0,y=d.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,lh,ph,vh,gh,fh,mh);var yh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=yh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var xh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},_h=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Oh(t));var i=t[e];return"string"==typeof i&&(i=xh[i]),i},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Th=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue,Dh=Phaser.Display.Align.CENTER;var Rh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},zh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Nh.prototype,Wh);const Gh=Phaser.Utils.Objects.GetValue;var Uh=Phaser.Renderer.WebGL.Utils,$h=function(t,e,i,s,r,n){for(var h=Uh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Qh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ta=Phaser.Renderer.Canvas.SetTransform;var ea={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&$h(r,h,e,l,a,o),e.isStroked&&qh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ta(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(sa.prototype,ea);const ra=Phaser.Utils.Objects.GetValue;let na=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ra(t,"x",0),i=ra(t,"y",0));var s=this.cornerRadius;s.tl=ha(ra(t,"tl",void 0),e,i),s.tr=ha(ra(t,"tr",void 0),e,i),s.bl=ha(ra(t,"bl",void 0),e,i),s.br=ha(ra(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){aa(this.cornerRadius.br,t)}};var ha=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oa(t),t},aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ra(e,"x",0),t.y=ra(e,"y",0)),oa(t)},oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},la=function(t){return t.x>0&&t.y>0},da=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ca=Phaser.Math.DegToRad;var ua=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const vo=Phaser.Utils.Objects.GetValue,go=Phaser.Utils.Objects.IsPlainObject;class fo extends(ja(Da)){constructor(t,e,i,s,r,n,h,a){go(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):go(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):go(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new uo).setName("trackFill")).addShape((new uo).setName("bar")).addShape((new uo).setName("trackStroke")),this.setTrackColor(vo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vo(a,"trackStrokeThickness",2),vo(a,"trackStrokeColor",void 0)),this.setSkewX(vo(a,"skewX",0)),this.setRTL(vo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var mo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&po(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),po(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&po(a,0,0,e,i,t)}};Object.assign(fo.prototype,mo);var bo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(bo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(bo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nAo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ao(t[i]));return e}const Io=Phaser.Utils.Objects.IsPlainObject,jo=Phaser.Utils.Objects.GetValue;var Wo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ho={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=zo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Ao(i),s=Ao(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var P=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return Io(t)?(this.stretchMode.edge=Wo(jo(t,"edge",0)),this.stretchMode.internal=Wo(jo(t,"internal",0))):(t=Wo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Go=Phaser.GameObjects;var Uo=void 0,$o=function(t,e){if(Uo||(Uo={},Ke(t).events.once("destroy",(function(){for(var t in Uo)Uo[t].destroy();Uo=void 0}))),!Uo.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Go[e](i)).setOrigin(0),Uo[e]=t}return Uo[e]};const Jo=Phaser.GameObjects.RenderTexture;class qo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ho),i}(Jo,"rexNinePatch")){}var Ko={_drawImage:function(t,e,i,s,r,n){var h=$o(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=$o(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(qo.prototype,Ko);class Zo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(wo(t,e))return t[e];var i=t.parent;return wo(i,e)?i[e]:void 0}set(t,e,i){return wo(t,e)?t[e]=i:wo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Qo=Phaser.Utils.Objects.GetValue;class tl extends qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Qo(e,"effects",!0);i&&To(this,i),this.style=new Zo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(tl.prototype,Pa);const el=["alpha","tint","flipX","flipY"];var il=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Co(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tl(t,e):new Do(t,e);break;default:s=new xa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=el.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const zl=Phaser.Utils.Objects.GetValue;class Al{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(zl(t,"value",0)),this.setSpeed(zl(t,"speed",0)),this.setAcceleration(zl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Il{constructor(){this.value,this.dir,this.movement=new Al}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Nl=Phaser.Utils.Objects.GetValue;var Gl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Nl(s,l,void 0):Nl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Dl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Nl(r,"position",0);"string"==typeof p&&(p=Ul[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Nl(s,"scrollDetectionMode");"string"==typeof y&&(y=$l[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,_,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==y&&(O.focus=1===y?2:0),S=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",x=`scroll${i}`):(w="t",x="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),b&&(a?(P=`childO${i}`,x=`scroll${i}`):(P="childOY",x="scroll"),b.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const Ul={right:0,left:1,bottom:0,top:1},$l={gameObject:0,rectBounds:1},Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jl(e,"width"),h=Jl(e,"height");n||Jl(e,"child.expandWidth",!0)||(s[1]=0),h||Jl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Gh(i,"child"),r=Gh(s,"gameObject",void 0);if(r){var n=Gh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),a.left=Gh(n,"left",0),a.right=Gh(n,"right",0);break;case 1:h.top=Gh(n,"left",0),h.bottom=Gh(n,"right",0),a.top=Gh(n,"top",0),a.bottom=Gh(n,"bottom",0);break;default:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),h.left=Gh(n,"left",0),h.right=Gh(n,"right",0)}e.add(r,{column:1,row:1,align:Gh(s,"align","center"),padding:a,expand:{width:Gh(s,"expandWidth",!0),height:Gh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Gl(t,a,"y",e);break;case 1:Gl(t,a,"x",e);break;default:Gl(t,a,"y",e),Gl(t,a,"x",e)}return a},Kl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Zl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Ql=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ad=Phaser.Utils.Objects.GetValue,od=Phaser.Utils.Array.SpliceOne;class ld{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new hd,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=ad(t,"cellHeight",60),i=ad(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(ad(t,"cellsCount",0)),this.setColumnCount(ad(t,"columns",1)),this}destroy(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}get defaultCellHeightMode(){return 0===this.nonZeroDeltaHeightCount}setDefaultCellHeight(t){return this.defaultCellHeight=t,this}setDefaultCellWidth(t){return this.defaultCellWidth=t,this}initCells(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var h=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=Md(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexholygrail.min.js b/dist/rexholygrail.min.js index bb8076165b..fc8cd6d066 100644 --- a/dist/rexholygrail.min.js +++ b/dist/rexholygrail.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ts={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Ts,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Gs=function(t,e){Yi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Tr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case En:this.tracerState=xn,this.onDrag1End();break;case Pn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const xn=0,En=1,Pn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},Tn={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Tn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ra[e];else if(ea(e)){var u;e=ia(u=e,"proportion",void 0),i=ia(u,"align",sa),s=ia(u,"padding",0),r=ia(u,"expand",!1),n=ia(u,"key",void 0),a=ia(u,"index",void 0),t.isRexSizer||(h=ia(u,"minWidth",void 0),o=ia(u,"minHeight",void 0)),l=ia(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);var Sa=function(t,e){if(t){var i=h(t);i&&i.remove(t,e)}};const xa=Phaser.Utils.Objects.GetValue;var Ea=function(t,e,i){var s=xa(t,`proportion.${e}`,i.proportion),r=xa(t,`align.${e}`,"center"),n=xa(t,`space.${e}`,void 0);if("number"==typeof n&&i.paddingKey){var a=n;(n={})[i.paddingKey]=a}return{proportion:s,align:r,padding:n,expand:xa(t,`expand.${e}`,!0)}},Pa=function(t){return Ea(t,"header",{proportion:0,paddingKey:"bottom"})},_a=function(t){return Ea(t,"leftSide",{proportion:0,paddingKey:"right"})},wa=function(t){return Ea(t,"content",{proportion:1})},Oa=function(t){return Ea(t,"rightSide",{proportion:0,paddingKey:"left"})},Ta=function(t){return Ea(t,"footer",{proportion:0,paddingKey:"top"})},ka=function(t,e){var i=new ba(t,{orientation:e});return t.add.existing(i),i};const Da=Phaser.Utils.Objects.GetValue,Ra=[function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=t.content;n&&s.add(n,wa(t));var a=t.rightSide;a&&s.add(a,Oa(t));var h=t.footer;h&&this.add(h,Ta(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=ka(e,1);s.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=ka(e,0);n.add(a,{proportion:1,align:"center",padding:0,expand:!0});var h=t.content;h&&a.add(h,wa(t));var o=t.rightSide;o&&a.add(o,Oa(t));var l=t.footer;l&&n.add(l,Ta(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=ka(e,1);s.add(r,{proportion:1,align:"center",padding:0,expand:!0});var n=ka(e,0);r.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=t.leftSide;a&&n.add(a,_a(t));var h=t.content;h&&n.add(h,wa(t));var o=t.footer;o&&r.add(o,Ta(t));var l=t.rightSide;l&&s.add(l,Oa(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=ka(e,1);s.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&n.add(a,wa(t));var h=t.footer;h&&n.add(h,Ta(t));var o=t.rightSide;o&&s.add(o,Oa(t))}],Ma={FFF:0,LFF:1,FFR:2,LFR:3};class La extends ba{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexHolyGrail",this.build(e)}}var za={build:function(t){void 0===t&&(t={});var e=t.background,i=t.header,s=t.leftSide,r=t.content,n=t.rightSide,a=t.footer;Sa(e),Sa(i),Sa(s),Sa(r),Sa(n),Sa(a),this.clear(!0),e&&this.addBackground(e);var h=Da(t,"layoutMode",0);return"string"==typeof h&&(h=Ma[h.toUpperCase()]),(Ra[h]||Ra[0]).call(this,t),this.addChildrenMap("background",e),this.addChildrenMap("header",i),this.addChildrenMap("leftSide",s),this.addChildrenMap("content",r),this.addChildrenMap("rightSide",n),this.addChildrenMap("footer",a),this}};return Object.assign(La.prototype,za),La},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexholygrail=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=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};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Ei extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ts={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Ts,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Gs=function(t,e){Yi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Tr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case En:this.tracerState=xn,this.onDrag1End();break;case Pn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const xn=0,En=1,Pn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},Tn={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Tn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ra[e];else if(ea(e)){var v;e=ia(v=e,"proportion",void 0),i=ia(v,"align",sa),s=ia(v,"padding",0),r=ia(v,"expand",!1),n=ia(v,"key",void 0),a=ia(v,"index",void 0),t.isRexSizer||(h=ia(v,"minWidth",void 0),o=ia(v,"minHeight",void 0)),l=ia(v,"fitRatio",0),d=ia(v,"offsetX",0),c=ia(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);var Sa=function(t,e){if(t){var i=h(t);i&&i.remove(t,e)}};const xa=Phaser.Utils.Objects.GetValue;var Ea=function(t,e,i){var s=xa(t,`proportion.${e}`,i.proportion),r=xa(t,`align.${e}`,"center"),n=xa(t,`space.${e}`,void 0);if("number"==typeof n&&i.paddingKey){var a=n;(n={})[i.paddingKey]=a}return{proportion:s,align:r,padding:n,expand:xa(t,`expand.${e}`,!0)}},Pa=function(t){return Ea(t,"header",{proportion:0,paddingKey:"bottom"})},_a=function(t){return Ea(t,"leftSide",{proportion:0,paddingKey:"right"})},wa=function(t){return Ea(t,"content",{proportion:1})},Oa=function(t){return Ea(t,"rightSide",{proportion:0,paddingKey:"left"})},Ta=function(t){return Ea(t,"footer",{proportion:0,paddingKey:"top"})},ka=function(t,e){var i=new ba(t,{orientation:e});return t.add.existing(i),i};const Da=Phaser.Utils.Objects.GetValue,Ra=[function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=t.content;n&&s.add(n,wa(t));var a=t.rightSide;a&&s.add(a,Oa(t));var h=t.footer;h&&this.add(h,Ta(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=ka(e,1);s.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=ka(e,0);n.add(a,{proportion:1,align:"center",padding:0,expand:!0});var h=t.content;h&&a.add(h,wa(t));var o=t.rightSide;o&&a.add(o,Oa(t));var l=t.footer;l&&n.add(l,Ta(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=ka(e,1);s.add(r,{proportion:1,align:"center",padding:0,expand:!0});var n=ka(e,0);r.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=t.leftSide;a&&n.add(a,_a(t));var h=t.content;h&&n.add(h,wa(t));var o=t.footer;o&&r.add(o,Ta(t));var l=t.rightSide;l&&s.add(l,Oa(t))},function(t){var e=this.scene,i=t.header;i&&this.add(i,Pa(t));var s=ka(e,0);this.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&s.add(r,_a(t));var n=ka(e,1);s.add(n,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&n.add(a,wa(t));var h=t.footer;h&&n.add(h,Ta(t));var o=t.rightSide;o&&s.add(o,Oa(t))}],Ma={FFF:0,LFF:1,FFR:2,LFR:3};class La extends ba{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexHolyGrail",this.build(e)}}var za={build:function(t){void 0===t&&(t={});var e=t.background,i=t.header,s=t.leftSide,r=t.content,n=t.rightSide,a=t.footer;Sa(e),Sa(i),Sa(s),Sa(r),Sa(n),Sa(a),this.clear(!0),e&&this.addBackground(e);var h=Da(t,"layoutMode",0);return"string"==typeof h&&(h=Ma[h.toUpperCase()]),(Ra[h]||Ra[0]).call(this,t),this.addChildrenMap("background",e),this.addChildrenMap("header",i),this.addChildrenMap("leftSide",s),this.addChildrenMap("content",r),this.addChildrenMap("rightSide",n),this.addChildrenMap("footer",a),this}};return Object.assign(La.prototype,za),La},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexholygrail=e(); diff --git a/dist/rexknob.js b/dist/rexknob.js index 3d1dfbfc4e..a03c01252c 100644 --- a/dist/rexknob.js +++ b/dist/rexknob.js @@ -12171,6 +12171,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexlabel.js b/dist/rexlabel.js index 7c735cfeb0..2a33cd05c8 100644 --- a/dist/rexlabel.js +++ b/dist/rexlabel.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$c(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$c(config, 'offsetX', 0); + offsetY = GetValue$c(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexlabel.min.js b/dist/rexlabel.min.js index 89da549601..8e783c6a46 100644 --- a/dist/rexlabel.min.js +++ b/dist/rexlabel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ti={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Xi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Ls);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ws extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},Vs=function(t,e){Ii(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case Tn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Ne);var wn={};const Sn=0,Pn=1,Tn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const Xn="IDLE",An="BEGIN",Fn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),Fr.call(t,e),Br.call(t,e),In.call(t,e),Bn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l){pe.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=nh[e];else if(ih(e)){var u;e=sh(u=e,"proportion",void 0),i=sh(u,"align",rh),s=sh(u,"padding",0),r=sh(u,"expand",!1),n=sh(u,"key",void 0),h=sh(u,"index",void 0),t.isRexSizer||(a=sh(u,"minWidth",void 0),o=sh(u,"minHeight",void 0)),l=sh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=kt.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){bh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends xh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Sh);var Th=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class _h extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=kh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Th.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Th.call(this,this.width,this.height,this.padding,t,e)),this}}const kh={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.GameObjects.Text;var Rh=function(t){return t instanceof Mh};const Dh=Phaser.GameObjects.BitmapText;var Lh=function(t){return t instanceof Dh},zh=/^[\x00-\x7F]+$/,Yh=function(t){return zh.test(t)},Xh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Fh=2;const Wh={none:0,word:1,char:Fh,character:Fh,mix:3};var Ih=function(t,e){var i=function(t){return Lh(t)?2:Rh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Xh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e}};const jh=Phaser.Renderer.WebGL.Utils;var Bh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=jh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Hh=Phaser.Display.Color;var Nh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Hh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Uh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Gh=Phaser.Display.Canvas.CanvasPool,Vh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class Jh extends Vh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Gh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Gh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Jh,[qh.Alpha,qh.BlendMode,qh.Crop,qh.Depth,qh.Flip,qh.GetBounds,qh.Mask,qh.Origin,qh.Pipeline,qh.PostPipeline,qh.ScrollFactor,qh.Tint,qh.Transform,qh.Visible,Bh,Nh,Uh]);var Zh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Kh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Kh.prototype,Zh);var Qh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ta=Phaser.Math.RotateAround;var ea;const ia=Phaser.Geom.Rectangle;var sa,ra=function(t){void 0===sa&&(sa=new ia);var e=t.drawTLX,i=t.drawTLY;return sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),sa};const na=Phaser.Math.RotateAround;var ha,aa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=e,s.y=i,0!==t.rotation&&na(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const oa=Phaser.GameObjects.Components.TransformMatrix;var la,da,ca={},ua=function(t,e,i,s,r){var n=aa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===la&&(la=new oa,da=new oa),t.parentContainer?t.getWorldTransformMatrix(la,da):la.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),la.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ua(t,e,n,h,r)},va={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ea&&(ea={}),s=ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ta(s,0,0,-i.rotation),s}(t,e,this,!0);return ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return pa(this.parent,this,t,e,i)}};Object.assign(va,Qh);const ga=Phaser.Math.DegToRad,fa=Phaser.Math.RadToDeg,ma=Phaser.Utils.Objects.GetValue;class ya extends Kh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return fa(this._rotation)}set angle(t){this.rotation=ga(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ma(t,"width",void 0),i=ma(t,"height",void 0),s=ma(t,"scaleX",void 0),r=ma(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ya.prototype,va);const ba=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},xa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const wa=Phaser.Utils.Objects.GetValue;class Sa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=wa(t,"x",0),i=wa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(wa(t,"tl",void 0),e,i),s.tr=Pa(wa(t,"tr",void 0),e,i),s.bl=Pa(wa(t,"bl",void 0),e,i),s.br=Pa(wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ta(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ta(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ta(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ta(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Oa(t),t},Ta=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=wa(e,"x",0),t.y=wa(e,"y",0)),Oa(t)},Oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var ka=function(t){return!t.hasOwnProperty("convex")||t.convex},Ea=function(t){return t.x>0&&t.y>0},Ma=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,l,o,l,180,270,!1,h):Ma(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,l,o,l,270,360,!1,h):Ma(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,r-l,o,l,0,90,!1,h):Ma(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,r-l,o,l,90,180,!1,h):Ma(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Da=Phaser.Utils.Objects.GetValue;class La extends ya{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Da(e,"color",null),Da(e,"color2",null),Da(e,"horizontalGradient",!0)),this.setStroke(Da(e,"stroke",null),Da(e,"strokeThickness",2)),this.setCornerRadius(Da(e,"cornerRadius",0),Da(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,xa("color2",t,this),xa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,xa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ra(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const za=Phaser.Utils.Objects.GetValue;class Ya extends ya{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,za(t,"color2",null),za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Xa=Phaser.Utils.Objects.GetValue;class Aa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Xa(t,"bold",!1)),this.setItalic(Xa(t,"italic",!1)),this.setFontSize(Xa(t,"fontSize","16px")),this.setFontFamily(Xa(t,"fontFamily","Courier")),this.setColor(Xa(t,"color","#fff")),this.setStrokeStyle(Xa(t,"stroke",null),Xa(t,"strokeThickness",0)),this.setShadow(Xa(t,"shadowColor",null),Xa(t,"shadowOffsetX",0),Xa(t,"shadowOffsetY",0),Xa(t,"shadowBlur",0)),this.setOffset(Xa(t,"offsetX",0),Xa(t,"offsetY",0)),this.setSpace(Xa(t,"leftSpace",0),Xa(t,"rightSpace",0)),this.setAlign(Xa(t,"align",void 0)),this.setBackgroundColor(Xa(t,"backgroundColor",null)),this.setBackgroundHeight(Xa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Xa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(xa("stroke",t,this),xa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(xa("shadowOffsetX",t,this),xa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Aa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Fa=Phaser.Utils.Array.Remove,Wa=Phaser.Utils.Array.Remove,Ia="text",ja="image",Ba="drawer",Ha="space",Na="command";var Ua=function(t){return t.type===Ia&&"\n"===t.text},Ga=function(t){return t.type===Ia&&"\f"===t.text},Va=function(t){return t.type===Ia};class $a extends ya{constructor(t,e,i){super(t,Ia),this.updateTextFlag=!1,this.style=new Aa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ja=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Za extends ya{constructor(t,e,i){super(t,ja),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ka extends ya{constructor(t,e,i,s){super(t,Ba),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Qa extends ya{constructor(t,e){super(t,Ha),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class to extends Kh{constructor(t,e,i,s,r){super(t,Na),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function eo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>eo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=eo(t[i]));return e}var io=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const so={none:0,word:1,char:2,character:2,mix:3};var ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=oo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=oo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=co(t,"wrapMode");void 0===c&&(c=co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=so[c]);var u=co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=co(t,"letterSpacing",0),v=co(t,"hAlign",0),g=co(t,"vAlign",0),f=co(t,"justifyPercentage",.25),m=io({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=vo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=vo(t,"maxLines",0);var a=0===i,o=vo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=vo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=vo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=vo(t,"letterSpacing",0),p=vo(t,"rtl",!0),v=vo(t,"hAlign",p?2:0),g=vo(t,"vAlign",0),f=io({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=k.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return ke(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Fa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Wa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ia);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Wo=Phaser.Utils.Objects.GetFastValue;var Io={};class jo{constructor(t){this.pools=Wo(t,"pools",Io)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Fo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Jo(t,r,e,i,n),a=0;a<=Go&&0!==h;a++){if((r+=h)<0){r=0;break}h=Jo(t,r,e,i,n)}return a===Go&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zo=Phaser.Utils.Objects.GetValue,Ko=Phaser.Utils.Objects.GetValue;return class extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ko(e,"background",void 0),r=Ko(e,"icon",void 0),n=Ko(e,"iconMask",void 0),h=Ko(e,"text",void 0),a=Ko(e,"action",void 0),o=Ko(e,"actionMask",void 0),l=Ko(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ko(e,"space.icon",0),top:Ko(e,"space.iconTop",0),bottom:Ko(e,"space.iconBottom",0),left:Ko(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ko(e,"space.icon",0),left:Ko(e,"space.iconLeft",0),right:Ko(e,"space.iconRight",0),top:Ko(e,"space.iconTop",0)});var d=Ko(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Eh.call(this,r,r,1)),!d){var c=Ko(e,"iconSize",void 0);this.setIconSize(Ko(e,"iconWidth",c),Ko(e,"iconHeight",c))}}if(h){var u=Ko(e,"wrapText",!1),p=Ko(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Ih(h,u),e.expandTextWidth=!0,Uo(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zo(e,"minWidth",0),s=Zo(e,"minHeight",0),r=Zo(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Vo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Vo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ko(e,"space.text",0),m=Ko(e,"expandTextWidth",!1),y=Ko(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ko(e,"space.actionTop",0),bottom:Ko(e,"space.actionBottom",0),right:Ko(e,"space.actionRight",0)}:{left:Ko(e,"space.actionLeft",0),right:Ko(e,"space.actionRight",0),bottom:Ko(e,"space.actionBottom",0)},d=Ko(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Eh.call(this,a,a,1)),!d)){var b=Ko(e,"actionSize");this.setActionSize(Ko(e,"actionWidth",b),Ko(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlabel=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ti={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ls);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ws extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},Vs=function(t,e){Ii(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends _s{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case Tn:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Ne);var wn={};const Sn=0,Pn=1,Tn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,Yn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Xn="IDLE",An="BEGIN",Fn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),zr.call(t,e),Fr.call(t,e),Br.call(t,e),In.call(t,e),Bn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l,d,c){pe.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=nh[e];else if(ih(e)){var v;e=sh(v=e,"proportion",void 0),i=sh(v,"align",rh),s=sh(v,"padding",0),r=sh(v,"expand",!1),n=sh(v,"key",void 0),h=sh(v,"index",void 0),t.isRexSizer||(a=sh(v,"minWidth",void 0),o=sh(v,"minHeight",void 0)),l=sh(v,"fitRatio",0),d=sh(v,"offsetX",0),c=sh(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=kt.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){bh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):bh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends xh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Sh);var Th=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class _h extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=kh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Th.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Th.call(this,this.width,this.height,this.padding,t,e)),this}}const kh={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.GameObjects.Text;var Rh=function(t){return t instanceof Mh};const Dh=Phaser.GameObjects.BitmapText;var Lh=function(t){return t instanceof Dh},Yh=/^[\x00-\x7F]+$/,zh=function(t){return Yh.test(t)},Xh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Fh=2;const Wh={none:0,word:1,char:Fh,character:Fh,mix:3};var Ih=function(t,e){var i=function(t){return Lh(t)?2:Rh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Xh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e}};const jh=Phaser.Renderer.WebGL.Utils;var Bh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=jh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Hh=Phaser.Display.Color;var Nh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Hh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Uh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Gh=Phaser.Display.Canvas.CanvasPool,Vh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class Jh extends Vh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Gh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Gh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const qh=Phaser.GameObjects.Components;Phaser.Class.mixin(Jh,[qh.Alpha,qh.BlendMode,qh.Crop,qh.Depth,qh.Flip,qh.GetBounds,qh.Mask,qh.Origin,qh.Pipeline,qh.PostPipeline,qh.ScrollFactor,qh.Tint,qh.Transform,qh.Visible,Bh,Nh,Uh]);var Zh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Kh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Kh.prototype,Zh);var Qh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ta=Phaser.Math.RotateAround;var ea;const ia=Phaser.Geom.Rectangle;var sa,ra=function(t){void 0===sa&&(sa=new ia);var e=t.drawTLX,i=t.drawTLY;return sa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),sa};const na=Phaser.Math.RotateAround;var ha,aa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ha&&(ha={}),s=ha),s.x=e,s.y=i,0!==t.rotation&&na(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const oa=Phaser.GameObjects.Components.TransformMatrix;var la,da,ca={},ua=function(t,e,i,s,r){var n=aa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===la&&(la=new oa,da=new oa),t.parentContainer?t.getWorldTransformMatrix(la,da):la.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),la.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},pa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return ua(t,e,n,h,r)},va={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ea&&(ea={}),s=ea),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ta(s,0,0,-i.rotation),s}(t,e,this,!0);return ra(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return pa(this.parent,this,t,e,i)}};Object.assign(va,Qh);const ga=Phaser.Math.DegToRad,fa=Phaser.Math.RadToDeg,ma=Phaser.Utils.Objects.GetValue;class ya extends Kh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return fa(this._rotation)}set angle(t){this.rotation=ga(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ma(t,"width",void 0),i=ma(t,"height",void 0),s=ma(t,"scaleX",void 0),r=ma(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ya.prototype,va);const ba=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ba(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},xa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const wa=Phaser.Utils.Objects.GetValue;class Sa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=wa(t,"x",0),i=wa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(wa(t,"tl",void 0),e,i),s.tr=Pa(wa(t,"tr",void 0),e,i),s.bl=Pa(wa(t,"bl",void 0),e,i),s.br=Pa(wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ta(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ta(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ta(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ta(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Oa(t),t},Ta=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=wa(e,"x",0),t.y=wa(e,"y",0)),Oa(t)},Oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var ka=function(t){return!t.hasOwnProperty("convex")||t.convex},Ea=function(t){return t.x>0&&t.y>0},Ma=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,l,o,l,180,270,!1,h):Ma(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,l,o,l,270,360,!1,h):Ma(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,s-o,r-l,o,l,0,90,!1,h):Ma(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ea(a)?(o=a.x*g,l=a.y*f,ka(a)?Ma(t,o,r-l,o,l,90,180,!1,h):Ma(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Da=Phaser.Utils.Objects.GetValue;class La extends ya{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Da(e,"color",null),Da(e,"color2",null),Da(e,"horizontalGradient",!0)),this.setStroke(Da(e,"stroke",null),Da(e,"strokeThickness",2)),this.setCornerRadius(Da(e,"cornerRadius",0),Da(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,xa("color2",t,this),xa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,xa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ra(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ya=Phaser.Utils.Objects.GetValue;class za extends ya{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ya(e,"color",null),Ya(e,"color2",null),Ya(e,"horizontalGradient",!0)),this.setStroke(Ya(e,"stroke",null),Ya(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ya(t,"color2",null),Ya(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ya(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Xa=Phaser.Utils.Objects.GetValue;class Aa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Xa(t,"bold",!1)),this.setItalic(Xa(t,"italic",!1)),this.setFontSize(Xa(t,"fontSize","16px")),this.setFontFamily(Xa(t,"fontFamily","Courier")),this.setColor(Xa(t,"color","#fff")),this.setStrokeStyle(Xa(t,"stroke",null),Xa(t,"strokeThickness",0)),this.setShadow(Xa(t,"shadowColor",null),Xa(t,"shadowOffsetX",0),Xa(t,"shadowOffsetY",0),Xa(t,"shadowBlur",0)),this.setOffset(Xa(t,"offsetX",0),Xa(t,"offsetY",0)),this.setSpace(Xa(t,"leftSpace",0),Xa(t,"rightSpace",0)),this.setAlign(Xa(t,"align",void 0)),this.setBackgroundColor(Xa(t,"backgroundColor",null)),this.setBackgroundHeight(Xa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Xa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(xa("stroke",t,this),xa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(xa("shadowOffsetX",t,this),xa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Aa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Fa=Phaser.Utils.Array.Remove,Wa=Phaser.Utils.Array.Remove,Ia="text",ja="image",Ba="drawer",Ha="space",Na="command";var Ua=function(t){return t.type===Ia&&"\n"===t.text},Ga=function(t){return t.type===Ia&&"\f"===t.text},Va=function(t){return t.type===Ia};class $a extends ya{constructor(t,e,i){super(t,Ia),this.updateTextFlag=!1,this.style=new Aa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ja=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const qa=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Za extends ya{constructor(t,e,i){super(t,ja),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=qa.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),qa.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ka extends ya{constructor(t,e,i,s){super(t,Ba),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Qa extends ya{constructor(t,e){super(t,Ha),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class to extends Kh{constructor(t,e,i,s,r){super(t,Na),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function eo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>eo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=eo(t[i]));return e}var io=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const so={none:0,word:1,char:2,character:2,mix:3};var ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=oo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=oo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=co(t,"wrapMode");void 0===c&&(c=co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=so[c]);var u=co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=co(t,"letterSpacing",0),v=co(t,"hAlign",0),g=co(t,"vAlign",0),f=co(t,"justifyPercentage",.25),m=io({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=k.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=vo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=vo(t,"maxLines",0);var a=0===i,o=vo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=vo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=vo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=vo(t,"letterSpacing",0),p=vo(t,"rtl",!0),v=vo(t,"hAlign",p?2:0),g=vo(t,"vAlign",0),f=io({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=k.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return ke(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Fa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Wa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ia);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),pa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Wo=Phaser.Utils.Objects.GetFastValue;var Io={};class jo{constructor(t){this.pools=Wo(t,"pools",Io)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Fo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Jo(t,r,e,i,n),a=0;a<=Go&&0!==h;a++){if((r+=h)<0){r=0;break}h=Jo(t,r,e,i,n)}return a===Go&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},qo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zo=Phaser.Utils.Objects.GetValue,Ko=Phaser.Utils.Objects.GetValue;return class extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ko(e,"background",void 0),r=Ko(e,"icon",void 0),n=Ko(e,"iconMask",void 0),h=Ko(e,"text",void 0),a=Ko(e,"action",void 0),o=Ko(e,"actionMask",void 0),l=Ko(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ko(e,"space.icon",0),top:Ko(e,"space.iconTop",0),bottom:Ko(e,"space.iconBottom",0),left:Ko(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ko(e,"space.icon",0),left:Ko(e,"space.iconLeft",0),right:Ko(e,"space.iconRight",0),top:Ko(e,"space.iconTop",0)});var d=Ko(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Eh.call(this,r,r,1)),!d){var c=Ko(e,"iconSize",void 0);this.setIconSize(Ko(e,"iconWidth",c),Ko(e,"iconHeight",c))}}if(h){var u=Ko(e,"wrapText",!1),p=Ko(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Ih(h,u),e.expandTextWidth=!0,Uo(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zo(e,"minWidth",0),s=Zo(e,"minHeight",0),r=Zo(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Vo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Vo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ko(e,"space.text",0),m=Ko(e,"expandTextWidth",!1),y=Ko(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ko(e,"space.actionTop",0),bottom:Ko(e,"space.actionBottom",0),right:Ko(e,"space.actionRight",0)}:{left:Ko(e,"space.actionLeft",0),right:Ko(e,"space.actionRight",0),bottom:Ko(e,"space.actionBottom",0)},d=Ko(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Eh.call(this,a,a,1)),!d)){var b=Ko(e,"actionSize");this.setActionSize(Ko(e,"actionWidth",b),Ko(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlabel=e(); diff --git a/dist/rexmdscenario.js b/dist/rexmdscenario.js index 9598c1bb57..133f0fa0ad 100644 --- a/dist/rexmdscenario.js +++ b/dist/rexmdscenario.js @@ -42226,7 +42226,7 @@ void main () { var LayoutChildren$4 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -42252,8 +42252,8 @@ void main () { continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -42282,10 +42282,10 @@ void main () { // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -42295,14 +42295,17 @@ void main () { width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -42500,6 +42503,7 @@ void main () { childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -42525,6 +42529,9 @@ void main () { } fitRatio = GetValue$19(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$19(config, 'offsetX', 0); + offsetY = GetValue$19(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -42565,12 +42572,21 @@ void main () { fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -61533,6 +61549,7 @@ void main () { minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexmdscenario.min.js b/dist/rexmdscenario.min.js index 87306eefa3..b864dde51c 100644 --- a/dist/rexmdscenario.min.js +++ b/dist/rexmdscenario.min.js @@ -8,21 +8,21 @@ * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */class Y extends L{constructor({expression:t="true",conditionEvalBreak:e=!1,children:i=[],services:s,title:r,name:n="IfSelector"}={},a){super({children:i,services:s,title:r,name:n,properties:{expression:t,conditionEvalBreak:e}},a),this.expression=this.addBooleanExpression(t),this.conditionEvalBreak=e,this.forceSelectChildIndex=void 0}open(t){this.getNodeMemory(t).$runningChild=-1}setSelectChildIndex(t){return this.forceSelectChildIndex=t,this}evalCondition(t){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:t.evalExpression(this.expression)?0:1}tick(t){if(0===this.children.length)return 9;var e=this.getNodeMemory(t),i=e.$runningChild;if(i<0&&(i=this.evalCondition(t),this.conditionEvalBreak))return e.$runningChild=i,3;var s=this.children[i]._execute(t);return e.$runningChild=3===s?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}}class W extends R{constructor({child:t=null,title:e,name:i="ForceFailure"}={},s){super({child:t,title:e,name:i,properties:{}},s)}tick(t){if(!this.child)return 9;var e=this.child._execute(t);return 1===e?2:e}}class X extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="Repeat"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=1;(i<0||s=i)return 2;var r=this.child._execute(t);return 1!==r&&2!==r||(e.$i=s+1),r}},Parallel:class extends L{constructor({finishMode:t=0,returnSuccess:e=!0,children:i=[],services:s,title:r,name:n="Parallel"}={},a){super({children:i,services:s,title:r,name:n,properties:{finishMode:t,returnSuccess:e}},a),this.finishMode=t,this.returnSuccess=e}open(t){this.getNodeMemory(t).$runningChildren=this.children.map(((t,e)=>e))}tick(t){if(0===this.children.length)return 9;for(var e=this.getNodeMemory(t),i=e.$runningChildren,s={},r=!1,n=!1,a=!1,o=!1,h=0,l=i.length;h=i)return 2;var r=this.child._execute(t);return 1!==r&&2!==r||(e.$i=s+1),r}},Parallel:class extends L{constructor({finishMode:t=0,returnSuccess:e=!0,children:i=[],services:s,title:r,name:n="Parallel"}={},a){super({children:i,services:s,title:r,name:n,properties:{finishMode:t,returnSuccess:e}},a),this.finishMode=t,this.returnSuccess=e}open(t){this.getNodeMemory(t).$runningChildren=this.children.map(((t,e)=>e))}tick(t){if(0===this.children.length)return 9;for(var e=this.getNodeMemory(t),i=e.$runningChildren,s={},r=!1,n=!1,a=!1,o=!1,h=0,l=i.length;h * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */,Repeat:X,RepeatUntilFailure:$,RepeatUntilSuccess:class extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="RepeatUntilSuccess"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s=r;if(n){e.$lastEndTime=i;r=t.evalExpression(this.intervalExpression);var a=t.evalExpression(this.randomDeviationExpression);a>0&&(r+=(.5-Math.random())*a),e.$interval=r}return n}},ShuffleSelector:class extends L{constructor({children:t=[],services:e,title:i,name:s="ShuffleSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){var e=this.getNodeMemory(t);e.$runningChild=0,e.$children||(e.$children=this.children.map(((t,e)=>e))),function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}}(e.$children)}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=i.$children,n=s,a=r.length;n=e.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(t)}},Wait:class extends A{constructor({duration:t=0,services:e,title:i,name:s="Wait"}={}){super({title:i,name:s,properties:{duration:t},services:e}),this.durationExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$startTime,r=e.$duration;if(r>0){if(i-st.id)),r.services&&(n.services=r.services.map((t=>t.id)));break;case o:r.child&&(n.child=r.child.id);break;case h:r.services&&(n.services=r.services.map((t=>t.id)))}t.nodes.push(n)}return t},load:function(t,e){var i=t.sn;null!=i&&p(Math.max(g(),i)),e=e||{},this.title=t.title||this.title,this.description=t.description||this.description,this.properties=t.properties||this.properties;for(var s=t.nodes,r={},n=s.length-1;n>=0;n--){var a,o=s[n],h=o.name;if(h in e)a=e[h];else{if(!(h in H))throw new EvalError(`BehaviorTree.load: Invalid node name "${h}".`);a=H[h]}var l={};o.hasOwnProperty("children")&&(l.children=o.children),o.hasOwnProperty("child")&&(l.child=o.child),o.hasOwnProperty("services")&&(l.services=o.services);var u=new a(l=Object.assign(l,o.properties),r);u.id=o.id||u.id,u.title=o.title||u.title,u.description=o.description||u.description,u.properties=o.properties||u.properties,r[u.id]=u}return this.root=r[t.root],this}};Object.assign(q.prototype,K,v);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(J(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(J(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0&&(G(this.trees,e),G(this.pendingTrees,e)),this}},lt={getTreeActiveState(t){var e=this.getTree(t);return e?e.active:null},setTreeActiveState(t,e){var i=this.getTree(t);return i&&i.setActive(e),this}};class ut extends z{open(t){super.open(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.enter",this.title,i.title,s.name,e)}tick(t){var e=super.tick(t);return 2===e&&(e=1),e}close(t){super.close(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.exit",this.title,i.title,s.name,e)}}var ct={pauseEventSheet(t){var e=t.tree.eventSheetGroup;this.isRunning=!0;var i=this,s=this.waitId;return function(){s":">",'"':""","'":"'","/":"/","`":"`","=":"="};var Ct=/\s*/,kt=/\s+/,St=/\s*=/,wt=/\s*\}/,_t=/#|\^|\/|>|\{|&|=|!/;function Et(t){this.string=t,this.tail=t,this.pos=0}function Tt(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Pt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Et.prototype.eos=function(){return""===this.tail},Et.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},Et.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},Tt.prototype.push=function(t){return new Tt(t,this)},Tt.prototype.lookup=function(t){var e,i,s,r=this.cache;if(r.hasOwnProperty(t))e=r[t];else{for(var n,a,o,h=this,l=!1;h;){if(t.indexOf(".")>0)for(n=h.view,a=t.split("."),o=0;null!=n&&o0?r[r.length-1][4]:i;break;default:s.push(e)}return i}(function(t){for(var e,i,s=[],r=0,n=t.length;r"===a?o=this.renderPartial(n,e,i,r):"&"===a?o=this.unescapedValue(n,e):"name"===a?o=this.escapedValue(n,e,r):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(h+=o);return h},Pt.prototype.renderSection=function(t,e,i,s,r){var n=this,a="",o=e.lookup(t[1]);if(o){if(pt(o))for(var h=0,l=o.length;h0||!i)&&(r[n]=s+r[n]);return r.join("\n")},Pt.prototype.renderPartial=function(t,e,i,s){if(i){var r=this.getConfigTags(s),n=gt(i)?i(t[1]):i[t[1]];if(null!=n){var a=t[6],o=t[5],h=t[4],l=n;0==o&&h&&(l=this.indentPartial(n,h,a));var u=this.parse(l,r);return this.renderTokens(u,e,i,l,s)}}},Pt.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);if(null!=i)return i},Pt.prototype.escapedValue=function(t,e,i){var s=this.getConfigEscape(i)||Ot.escape,r=e.lookup(t[1]);if(null!=r)return"number"==typeof r&&s===Ot.escape?String(r):s(r)},Pt.prototype.rawValue=function(t){return t[1]},Pt.prototype.getConfigTags=function(t){return pt(t)?t:t&&"object"==typeof t?t.tags:void 0},Pt.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!pt(t)?t.escape:void 0};var Ot={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Mt.templateCache=t},get templateCache(){return Mt.templateCache}},Mt=new Pt;Ot.clearCache=function(){return Mt.clearCache()},Ot.parse=function(t,e){return Mt.parse(t,e)},Ot.render=function(t,e,i,s){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+((pt(r=t)?"array":typeof r)+'" was given as the first argument for mustache#render(template, view, partials)'));var r;return Mt.render(t,e,i,s)},Ot.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return xt[t]}))},Ot.Scanner=Et,Ot.Context=Tt,Ot.Writer=Pt;class Dt extends A{constructor(t){super({name:"TaskAction",title:t.name,properties:t});var e=t.parameters,i={};for(var s in e)i[s]=At(e[s]);this.taskParameters=i,this.isRunning=!1,this.waitId=0}open(t){this.isRunning=!1;var e=this.properties.name;if(e){var i=t.blackboard.eventSheetManager,s=t.tree,r=i.memory,n=this.taskParameters,a={};for(var o in n){var h=n[o];"function"==typeof h&&(h=h(r)),a[o]=h}i.bindTaskActionNode(t,this);var l,u,c=t.target,d=c[e];d?l=d.call(c,a,i,s):(d=c.defaultHandler)&&(l=d.call(c,e,a,i,s)),i.unBindTaskAction(t,this),!this.isRunning&&((u=l)&&"object"==typeof u&&u.on)&&this.pauseEventSheetUnitlEvent(t,l)}}tick(t){return this.isRunning?this.RUNNING:this.SUCCESS}close(t){}abort(t){this.removeTaskCompleteCallback&&this.removeTaskCompleteCallback()}}var At=function(t){if("string"==typeof t)if(t.startsWith("#(")&&t.endsWith(")"))t=E(t.substring(2,t.length-1));else if(t.indexOf("{{")>-1&&t.indexOf("}}")>-1){var e=t;t=function(t){return Ot.render(e,t)}}return t};Object.assign(Dt.prototype,ct);class Lt extends A{constructor({activateTreeTitle:t,services:e,title:i,name:s="ActivateTree"}={}){super({name:s,title:i,properties:{activateTreeTitle:t},services:e}),this.activateTreeTitle=t}tick(t){var e=this.getTree(t);return this.activateTreeTitle&&""!==this.activateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.activateTreeTitle,e.groupName,!0):e.setActive(!0),this.SUCCESS}}class Rt extends A{constructor({deactivateTreeTitle:t,services:e,title:i,name:s="DeactivateTree"}={}){super({name:s,title:i,properties:{deactivateTreeTitle:t},services:e}),this.deactivateTreeTitle=t}tick(t){var e=this.getTree(t);return this.deactivateTreeTitle&&""!==this.deactivateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.deactivateTreeTitle,e.groupName,!1):e.setActive(!1),this.SUCCESS}}var Ft={TaskSequence:ut,TaskAction:Dt,ActivateAction:Lt,DeactivateAction:Rt},Bt={dumpEventSheetGroup(){return this.trees.map((function(t){return t.dump()}))},loadEventSheetGroup(t){return t.forEach((function(t){var e=new q({id:t.id,title:t.title,properties:y(t.properties)});e.load(t,Ft),this.trees.push(e)}),this),this}},It={dumpState(t=!1){var e={isRunning:this.isRunning,pendingTrees:this.pendingTrees.filter((function(t){return!t.roundComplete})).map((function(t){return t.id}))};return t&&(e.trees=this.dumpEventSheetGroup()),e},loadState(t){this.stop(),t.trees&&(this.trees.length=0,this.loadEventSheetGroup(t.trees)),this.isRunning=t.isRunning;var e=this.pendingTrees;return e.length=0,this.trees.forEach((function(i){t.pendingTrees.indexOf(i.id)>-1&&e.push(i)})),this}},jt=function(t,e){var i=t.blackboard,s=t.commandExecutor;e.start(i,s)&&(e.conditionPassed?t.emit("eventsheet.enter",e.title,this.name,t):t.emit("eventsheet.catch",e.title,this.name,t))},zt=function(t,e){var i=t.blackboard,s=t.commandExecutor;return e.tick(i,s)},Nt=function(t,e){e.conditionPassed&&t.emit("eventsheet.exit",e.title,this.name,t)},Gt={start(){if(this.isRunning)return this;this.isRunning=!0;var t=this.parent,e=this.trees,i=this.pendingTrees,s=t.blackboard;t.emit("start",this.name,t);for(var r=0,n=e.length;r0&&G(e,i),0===e.length&&(this.isRunning=!1,t.emit("complete",this.name,t)),this},startTree(t,e=!0){if(this.isRunning)return this;var i=this.getTree(t);if(!i)return this;this.isRunning=!0;var s=this.parent,r=this.pendingTrees,n=s.blackboard;return r.length=0,i.resetState(n),i.setConditionEnable(!e),jt.call(this,s,i),i.setConditionEnable(!0),r.push(i),this.continue(),this}},Yt={stop(){for(var t=this.parent,e=t.blackboard,i=t.commandExecutor,s=this.pendingTrees,r=0,n=s.length;r":">",'"':""","'":"'","`":"`","=":"="},se=/[&<>"'`=]/g,re=/[&<>"'`=]/;function ne(t){return ie[t]}function ae(t){for(var e=1;e0?(s.ids&&(s.ids=[s.name]),t.helpers.each(e,s)):r(this);if(s.data&&s.ids){var a=i.createFrame(s.data);a.contextPath=i.appendContextPath(s.data.contextPath,s.name),s={data:a}}return n(e,s)}))},t.exports=e.default}(pe,pe.exports);var ge=pe.exports,fe={exports:{}};!function(t,e){e.__esModule=!0;var i,s=ee,r=(i=ce)&&i.__esModule?i:{default:i};e.default=function(t){t.registerHelper("each",(function(t,e){if(!e)throw new r.default("Must pass iterator to #each");var i,n=e.fn,a=e.inverse,o=0,h="",l=void 0,u=void 0;function c(e,i,r){l&&(l.key=e,l.index=i,l.first=0===i,l.last=!!r,u&&(l.contextPath=u+e)),h+=n(t[e],{data:l,blockParams:s.blockParams([t[e],e],[u+e,null])})}if(e.data&&e.ids&&(u=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),s.isFunction(t)&&(t=t.call(this)),e.data&&(l=s.createFrame(e.data)),t&&"object"==typeof t)if(s.isArray(t))for(var d=t.length;o=0?e:parseInt(t,10)}return t},log:function(t){if(t=s.lookupLevel(t),"undefined"!=typeof console&&s.lookupLevel(s.level)<=t){var e=s.methodMap[t];console[e]||(e="log");for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var ii="[object Object]";function si(t,e,i){this.helpers=t||{},this.partials=e||{},this.decorators=i||{},Ze.registerDefaultHelpers(this),Qe.registerDefaultDecorators(this)}si.prototype={constructor:si,logger:ti.default,log:ti.default.log,registerHelper:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple helpers");Ke.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(Ke.toString.call(t)===ii)Ke.extend(this.partials,t);else{if(void 0===e)throw new Je.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple decorators");Ke.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){ei.resetLoggedProperties()}};var ri=ti.default.log;te.log=ri,te.createFrame=Ke.createFrame,te.logger=ti.default;var ni={exports:{}};!function(t,e){function i(t){this.string=t}e.__esModule=!0,i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},e.default=i,t.exports=e.default}(ni,ni.exports);var ai=ni.exports,oi={},hi={};hi.__esModule=!0,hi.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}},oi.__esModule=!0,oi.checkRevision=function(t){var e=t&&t[0]||1,i=ci.COMPILER_REVISION;if(e>=ci.LAST_COMPATIBLE_COMPILER_REVISION&&e<=ci.COMPILER_REVISION)return;if(e2&&y.push("'"+this.terminals_[f]+"'");C=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[c]||c)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==c?"end of input":"'"+(this.terminals_[c]||c)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[c]||c,line:this.lexer.yylineno,loc:l,expected:y})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+c);switch(p[0]){case 1:i.push(c),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(p[1]),c=null,h=this.lexer.yyleng,a=this.lexer.yytext,o=this.lexer.yylineno,l=this.lexer.yylloc;break;case 2:if(v=this.productions_[p[1]][1],x.$=s[s.length-v],x._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},u&&(x._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),void 0!==(g=this.performAction.call(x,a,h,o,this.yy,p[1],s,r)))return g;v&&(i=i.slice(0,-1*v*2),s=s.slice(0,-1*v),r=r.slice(0,-1*v)),i.push(this.productions_[p[1]][0]),s.push(x.$),r.push(x._$),m=n[i[i.length-2]][i[i.length-1]],i.push(m);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;ae[0].length)||(e=i,s=a,this.options.flex));a++);return e?((r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){function r(t,i){return e.yytext=e.yytext.substring(t,e.yyleng-i+t)}switch(i){case 0:if("\\\\"===e.yytext.slice(-2)?(r(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(r(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(r(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=r(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=r(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function i(){this.yy={}}return t.lexer=e,i.prototype=t,t.Parser=i,new i}();e.default=i,t.exports=e.default}(wi,wi.exports);var _i=wi.exports,Ei={exports:{}},Ti={exports:{}};!function(t,e){e.__esModule=!0;var i=function(t){return t&&t.__esModule?t:{default:t}}(ce);function s(){this.parents=[]}function r(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function n(t){r.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function a(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var r=this.accept(t[e]);if(this.mutating){if(r&&!s.prototype[r.type])throw new i.default('Unexpected node type "'+r.type+'" found when accepting '+e+" on "+t.type);t[e]=r}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new i.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,i=t.length;e0)throw new Di.default("Invalid path: "+s,{loc:i});".."===h&&n++}}return{type:"PathExpression",data:t,depth:n,parts:r,original:s,loc:i}},Mi.prepareMustache=function(t,e,i,s,r,n){var a=s.charAt(3)||s.charAt(2),o="{"!==a&&"&"!==a;return{type:/\*/.test(s)?"Decorator":"MustacheStatement",path:t,params:e,hash:i,escaped:o,strip:r,loc:this.locInfo(n)}},Mi.prepareRawBlock=function(t,e,i,s){Ai(t,i),s=this.locInfo(s);var r={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:r,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}},Mi.prepareBlock=function(t,e,i,s,r,n){s&&s.path&&Ai(t,s);var a=/\*/.test(t.open);e.blockParams=t.blockParams;var o=void 0,h=void 0;if(i){if(a)throw new Di.default("Unexpected inverse block on decorator",i);i.chain&&(i.program.body[0].closeStrip=s.strip),h=i.strip,o=i.program}r&&(r=o,o=e,e=r);return{type:a?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:o,openStrip:t.strip,inverseStrip:h,closeStrip:s&&s.strip,loc:this.locInfo(n)}},Mi.prepareProgram=function(t,e){if(!e&&t.length){var i=t[0].loc,s=t[t.length-1].loc;i&&s&&(e={source:i.source,start:{line:i.start.line,column:i.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},Mi.preparePartialBlock=function(t,e,i,s){return Ai(t,i),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:i&&i.strip,loc:this.locInfo(s)}};var Di=function(t){return t&&t.__esModule?t:{default:t}}(ce);function Ai(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var i={loc:t.path.loc};throw new Di.default(t.path.original+" doesn't match "+e,i)}}function Li(t){return t&&t.__esModule?t:{default:t}}Si.__esModule=!0,Si.parseWithoutProcessing=zi,Si.parse=function(t,e){var i=zi(t,e);return new Fi.default(e).accept(i)};var Ri=Li(_i),Fi=Li(Oi),Bi=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(Mi),Ii=ee;Si.parser=Ri.default;var ji={};function zi(t,e){return"Program"===t.type?t:(Ri.default.yy=ji,ji.locInfo=function(t){return new ji.SourceLocation(e&&e.srcName,t)},Ri.default.parse(t))}Ii.extend(ji,Bi);var Ni={};function Gi(t){return t&&t.__esModule?t:{default:t}}Ni.__esModule=!0,Ni.Compiler=Vi,Ni.precompile=function(t,e,i){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var s=i.parse(t,e),r=(new i.Compiler).compile(s,e);return(new i.JavaScriptCompiler).compile(r,e)},Ni.compile=function(t,e,i){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=Wi.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var s=void 0;function r(){var s=i.parse(t,e),r=(new i.Compiler).compile(s,e),n=(new i.JavaScriptCompiler).compile(r,e,void 0,!0);return i.template(n)}function n(t,e){return s||(s=r()),s.call(this,t,e)}return n._setup=function(t){return s||(s=r()),s._setup(t)},n._child=function(t,e,i,n){return s||(s=r()),s._child(t,e,i,n)},n};var Yi=Gi(ce),Wi=ee,Xi=Gi(ki),$i=[].slice;function Vi(){}function Hi(t,e){if(t===e)return!0;if(Wi.isArray(t)&&Wi.isArray(e)&&t.length===e.length){for(var i=0;i1)throw new Yi.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var s=t.name.original,r="SubExpression"===t.name.type;r&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var n=t.indent||"";this.options.preventIndent&&n&&(this.opcode("appendContent",n),n=""),this.opcode("invokePartial",r,s,n),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Ui(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var s=t.path,r=s.parts[0],n=null!=e||null!=i;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",r,n)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var s=this.setupFullMustacheParams(t,e,i),r=t.path,n=r.parts[0];if(this.options.knownHelpers[n])this.opcode("invokeKnownHelper",s.length,n);else{if(this.options.knownHelpersOnly)throw new Yi.default("You specified knownHelpersOnly, but used the unknown helper "+n,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",s.length,r.original,Xi.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=Xi.default.helpers.scopedId(t),s=!t.depth&&!i&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,s=e.length;for(this.opcode("pushHash");i=0)return[e,r]}}};var qi,Ki,Ji={exports:{}},Zi={exports:{}},Qi={},ts={},es={},is={};function ss(){if(qi)return is;qi=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return is.encode=function(e){if(0<=e&&e>>=5)>0&&(i|=32),s+=t.encode(i)}while(r>0);return s},es.decode=function(e,i,s){var r,n,a,o,h=e.length,l=0,u=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=t.decode(e.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+e.charAt(i-1));r=!!(32&n),l+=(n&=31)<>1,1&~a?o:-o),s.rest=i},es}var ns,as={};function os(){return ns||(ns=1,function(t){t.getArg=function(t,e,i){if(e in t)return t[e];if(3===arguments.length)return i;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function s(t){var i=t.match(e);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function r(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function n(e){var i=e,n=s(e);if(n){if(!n.path)return e;i=n.path}for(var a,o=t.isAbsolute(i),h=i.split(/\/+/),l=0,u=h.length-1;u>=0;u--)"."===(a=h[u])?h.splice(u,1):".."===a?l++:l>0&&(""===a?(h.splice(u+1,l),l=0):(h.splice(u,2),l--));return""===(i=h.join("/"))&&(i=o?"/":"."),n?(n.path=i,r(n)):i}function a(t,e){""===t&&(t="."),""===e&&(e=".");var a=s(e),o=s(t);if(o&&(t=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),r(a);if(a||e.match(i))return e;if(o&&!o.host&&!o.path)return o.host=e,r(o);var h="/"===e.charAt(0)?e:n(t.replace(/\/+$/,"")+"/"+e);return o?(o.path=h,r(o)):h}t.urlParse=s,t.urlGenerate=r,t.normalize=n,t.join=a,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var i=0;0!==e.indexOf(t+"/");){var s=t.lastIndexOf("/");if(s<0)return e;if((t=t.slice(0,s)).match(/^([^\/]+:\/)?\/*$/))return e;++i}return Array(i+1).join("../")+e.substr(t.length+1)};var o=!("__proto__"in Object.create(null));function h(t){return t}function l(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var i=e-10;i>=0;i--)if(36!==t.charCodeAt(i))return!1;return!0}function u(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=o?h:function(t){return l(t)?"$"+t:t},t.fromSetString=o?h:function(t){return l(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,i){var s=u(t.source,e.source);return 0!==s||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)||i||0!==(s=t.generatedColumn-e.generatedColumn)||0!==(s=t.generatedLine-e.generatedLine)?s:u(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,i){var s=t.generatedLine-e.generatedLine;return 0!==s||0!==(s=t.generatedColumn-e.generatedColumn)||i||0!==(s=u(t.source,e.source))||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)?s:u(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var i=t.generatedLine-e.generatedLine;return 0!==i||0!==(i=t.generatedColumn-e.generatedColumn)||0!==(i=u(t.source,e.source))||0!==(i=t.originalLine-e.originalLine)||0!==(i=t.originalColumn-e.originalColumn)?i:u(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,i){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),i){var o=s(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}e=a(r(o),e)}return n(e)}}(as)),as}var hs,ls={};function us(){if(hs)return ls;hs=1;var t=os(),e=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function s(){this._array=[],this._set=i?new Map:Object.create(null)}return s.fromArray=function(t,e){for(var i=new s,r=0,n=t.length;r=0)return r}else{var n=t.toSetString(s);if(e.call(this._set,n))return this._set[n]}throw new Error('"'+s+'" is not in the set.')},s.prototype.at=function(t){if(t>=0&&tr||n==r&&o>=a||t.compareByGeneratedPositionsInflated(i,s)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},ps.MappingList=e,ps}function fs(){if(ds)return ts;ds=1;var t=rs(),e=os(),i=us().ArraySet,s=gs().MappingList;function r(t){t||(t={}),this._file=e.getArg(t,"file",null),this._sourceRoot=e.getArg(t,"sourceRoot",null),this._skipValidation=e.getArg(t,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}return r.prototype._version=3,r.fromSourceMap=function(t){var i=t.sourceRoot,s=new r({file:t.file,sourceRoot:i});return t.eachMapping((function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=i&&(r.source=e.relative(i,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),s.addMapping(r)})),t.sources.forEach((function(r){var n=r;null!==i&&(n=e.relative(i,r)),s._sources.has(n)||s._sources.add(n);var a=t.sourceContentFor(r);null!=a&&s.setSourceContent(r,a)})),s},r.prototype.addMapping=function(t){var i=e.getArg(t,"generated"),s=e.getArg(t,"original",null),r=e.getArg(t,"source",null),n=e.getArg(t,"name",null);this._skipValidation||this._validateMapping(i,s,r,n),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=s&&s.line,originalColumn:null!=s&&s.column,source:r,name:n})},r.prototype.setSourceContent=function(t,i){var s=t;null!=this._sourceRoot&&(s=e.relative(this._sourceRoot,s)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(s)]=i):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(s)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(t,s,r){var n=s;if(null==s){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=t.file}var a=this._sourceRoot;null!=a&&(n=e.relative(a,n));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===n&&null!=i.originalLine){var s=t.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=s.source&&(i.source=s.source,null!=r&&(i.source=e.join(r,i.source)),null!=a&&(i.source=e.relative(a,i.source)),i.originalLine=s.line,i.originalColumn=s.column,null!=s.name&&(i.name=s.name))}var l=i.source;null==l||o.has(l)||o.add(l);var u=i.name;null==u||h.has(u)||h.add(u)}),this),this._sources=o,this._names=h,t.sources.forEach((function(i){var s=t.sourceContentFor(i);null!=s&&(null!=r&&(i=e.join(r,i)),null!=a&&(i=e.relative(a,i)),this.setSourceContent(i,s))}),this)},r.prototype._validateMapping=function(t,e,i,s){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||i||s)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:i,original:e,name:s}))},r.prototype._serializeMappings=function(){for(var i,s,r,n,a=0,o=1,h=0,l=0,u=0,c=0,d="",p=this._mappings.toArray(),g=0,f=p.length;g0){if(!e.compareByGeneratedPositionsInflated(s,p[g-1]))continue;i+=","}i+=t.encode(s.generatedColumn-a),a=s.generatedColumn,null!=s.source&&(n=this._sources.indexOf(s.source),i+=t.encode(n-c),c=n,i+=t.encode(s.originalLine-1-l),l=s.originalLine-1,i+=t.encode(s.originalColumn-h),h=s.originalColumn,null!=s.name&&(r=this._names.indexOf(s.name),i+=t.encode(r-u),u=r)),d+=i}return d},r.prototype._generateSourcesContent=function(t,i){return t.map((function(t){if(!this._sourcesContents)return null;null!=i&&(t=e.relative(i,t));var s=e.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null}),this)},r.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},ts.SourceMapGenerator=r,ts}var vs,ms={},ys={};function bs(){return vs||(vs=1,function(t){function e(i,s,r,n,a,o){var h=Math.floor((s-i)/2)+i,l=a(r,n[h],!0);return 0===l?h:l>0?s-h>1?e(h,s,r,n,a,o):o==t.LEAST_UPPER_BOUND?s1?e(i,h,r,n,a,o):o==t.LEAST_UPPER_BOUND?h:i<0?-1:i}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(i,s,r,n){if(0===s.length)return-1;var a=e(-1,s.length,i,s,r,n||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===r(s[a],s[a-1],!0);)--a;return a}}(ys)),ys}var xs,Cs,ks={};function Ss(){if(xs)return ks;function t(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function e(i,s,r,n){if(r=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var l=o.originalColumn;o&&o.originalLine===s&&o.originalColumn==l;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return n},ms.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(e){var i,s=e;if(null!=this.sourceRoot&&(s=t.relative(this.sourceRoot,s)),this._sources.has(s))return this._sources.indexOf(s);for(i=0;i1&&(n.source=f+h[1],f+=h[1],n.originalLine=p+h[2],p=n.originalLine,n.originalLine+=1,n.originalColumn=g+h[3],g=n.originalColumn,h.length>4&&(n.name=v+h[4],v+=h[4])),k.push(n),"number"==typeof n.originalLine&&C.push(n)}r(k,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,r(C,t.compareByOriginalPositions),this.__originalMappings=C},a.prototype._findMapping=function(t,i,s,r,n,a){if(t[s]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[s]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return e.search(t,i,n,a)},a.prototype.computeColumnSpans=function(){for(var t=0;t=0){var r=this._generatedMappings[s];if(r.generatedLine===i.generatedLine){var a=t.getArg(r,"source",null);null!==a&&(a=this._sources.at(a),a=t.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=t.getArg(r,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:t.getArg(r,"originalLine",null),column:t.getArg(r,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t}))},a.prototype.sourceContentFor=function(e,i){if(!this.sourcesContent)return null;var s=this._findSourceIndex(e);if(s>=0)return this.sourcesContent[s];var r,n=e;if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var a=n.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!r.path||"/"==r.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(i)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(e){var i=t.getArg(e,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var s={source:i,originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")},r=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var a=this._originalMappings[r];if(a.source===s.source)return{line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},ms.BasicSourceMapConsumer=a,h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var t=[],e=0;e=0;e--)this.prepend(t[e]);else{if(!t[s]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},r.prototype.walk=function(t){for(var e,i=0,r=this.children.length;i0){for(e=[],i=0;i0&&(i+=", "+s.join(", "));var r=0;Object.keys(this.aliases).forEach((function(t){var s=e.aliases[t];s.children&&s.referenceCount>1&&(i+=", alias"+ ++r+"="+t,s.children[0]="alias"+r)})),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var n=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths");var a=this.mergeSource(i);return t?(n.push(a),Function.apply(this,n)):this.source.wrap(["function(",n.join(","),") {\n ",a,"}"])},mergeSource:function(t){var e=this.environment.isSimple,i=!this.forceBuffer,s=void 0,r=void 0,n=void 0,a=void 0;return this.source.each((function(t){t.appendToBuffer?(n?t.prepend(" + "):n=t,a=t):(n&&(r?n.prepend("buffer += "):s=!0,a.add(";"),n=a=void 0),r=!0,e||(i=!1))})),i?n?(n.prepend("return "),a.add(";")):r||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),n?(n.prepend("return buffer + "),a.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var s=this.popStack();i.splice(1,0,s),this.push(this.source.functionCall(e,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var i=this.topStack();e.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack((function(t){return[" != null ? ",t,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,i,s){var r=0;s||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[r++])),this.resolvePath("context",t,r,e,i)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,i)},resolvePath:function(t,e,i,s,r){var n=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,i,s,r){var n=e.popStack(),a=i.length;t&&a--;for(;sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,i=t.length;ee[t],set(i){e[t]=i},enumerable:!0,configurable:!0}),this}setTreeGroup(t){return this.groupName=t,this.eventSheetGroup=this.eventSheetManager.getTreeGroup(t),this}setActive(t){return void 0===t&&(t=!0),this.active=t,this}get roundComplete(){return 2===this.roundState}set roundComplete(t){this.roundState=t?2:1}setConditionEnable(t=!0){var e=t?void 0:0;return this.root.setSelectChildIndex(e),this}start(t,e){if(1===this.roundState)return!1;var i=3!==this.getState(t);if(i&&this.resetState(t),this.roundState=1,super.tick(t,e),i){var s=this.root.getNodeMemory(this.ticker);this.conditionPassed=0===s.$runningChild}return!0}tick(t,e){var i=super.tick(t,e);return 3!==i&&(this.roundState=2,this.conditionPassed&&this.properties.once&&this.setActive(!1)),i}abort(t,e){this.roundState=0,super.abort(t,e)}}var Ns={exports:{}};!function(t,e){!function(t){function e(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,s=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function a(t){return c[t]}t.defaults=n();var o=/[&<>"']/,h=new RegExp(o.source,"g"),l=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,u=new RegExp(l.source,"g"),c={"&":"&","<":"<",">":">",'"':""","'":"'"};function d(t,e){if(e){if(o.test(t))return t.replace(h,a)}else if(l.test(t))return t.replace(u,a);return t}var p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(t){return t.replace(p,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var f=/(^|[^\[])\^/g;function v(t,e){t="string"==typeof t?t:t.source,e=e||"";var i={replace:function(e,s){return s=(s=s.source||s).replace(f,"$1"),t=t.replace(e,s),i},getRegex:function(){return new RegExp(t,e)}};return i}var m=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(t,e,i){if(t){try{s=decodeURIComponent(g(i)).replace(m,"").toLowerCase()}catch(t){return null}if(0===s.indexOf("javascript:")||0===s.indexOf("vbscript:")||0===s.indexOf("data:"))return null}var s;e&&!y.test(i)&&(t=i,x[" "+(s=e)]||(C.test(s)?x[" "+s]=s+"/":x[" "+s]=E(s,"/",!0)),e=-1===(s=x[" "+s]).indexOf(":"),i="//"===t.substring(0,2)?e?t:s.replace(k,"$1")+t:"/"===t.charAt(0)?e?t:s.replace(S,"$1")+t:s+t);try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var x={},C=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,S=/^([^:]+:\/*[^/]*)[\s\S]*$/,w={exec:function(){}};function _(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var s=!1,r=e;0<=--r&&"\\"===i[r];)s=!s;return s?"|":" |"})).split(/ \|/),s=0;if(i[0].trim()||i.shift(),0e)i.splice(e);else for(;i.length>=1,t+=t;return i+t}function P(t,e,i,s){var r=e.href,n=(e=e.title?d(e.title):null,t[1].replace(/\\([\[\]])/g,"$1"));return"!"!==t[0].charAt(0)?(s.state.inLink=!0,t={type:"link",raw:i,href:r,title:e,text:n,tokens:s.inlineTokens(n)},s.state.inLink=!1,t):{type:"image",raw:i,href:r,title:e,text:d(n)}}var O=function(){function e(e){this.options=e||t.defaults}var i=e.prototype;return i.space=function(t){if((t=this.rules.block.newline.exec(t))&&0=r.length?t.slice(r.length):t})).join("\n")),{type:"code",raw:e,lang:t[2]&&t[2].trim().replace(this.rules.inline._escapes,"$1"),text:i}},i.heading=function(t){var e,i;if(t=this.rules.block.heading.exec(t))return e=t[2].trim(),/#$/.test(e)&&(i=E(e,"#"),!this.options.pedantic&&i&&!/ $/.test(i)||(e=i.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}},i.hr=function(t){if(t=this.rules.block.hr.exec(t))return{type:"hr",raw:t[0]}},i.blockquote=function(t){var e,i,s;if(t=this.rules.block.blockquote.exec(t))return e=t[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top,this.lexer.state.top=!0,s=this.lexer.blockTokens(e),this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}},i.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,s,r,n,a,o,h,l,u,c,d,p=1<(f=e[1].trim()).length,g={type:"list",raw:"",ordered:p,start:p?+f.slice(0,-1):"",loose:!1,items:[]},f=p?"\\d{1,9}\\"+f.slice(-1):"\\"+f;this.options.pedantic&&(f=p?f:"[*+-]");for(var v=new RegExp("^( {0,3}"+f+")((?:[\t ][^\\n]*)?(?:\\n|$))");t&&(d=!1,e=v.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(function(t){return" ".repeat(3*t.length)})),l=t.split("\n",1)[0],this.options.pedantic?(n=2,c=h.trimLeft()):(n=e[2].search(/[^ ]/),c=h.slice(n=4=n||!l.trim())c+="\n"+l.slice(n);else{if(a)break;if(4<=h.search(/[^ ]/))break;if(b.test(h))break;if(x.test(h))break;if(y.test(h))break;c+="\n"+l}a||l.trim()||(a=!0),i+=u+"\n",t=t.substring(u.length+1),h=l.slice(n)}g.loose||(o?g.loose=!0:/\n *\n *$/.test(i)&&(o=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==s[0],c=c.replace(/^\[[ xX]\] +/,"")),g.items.push({type:"list_item",raw:i,task:!!s,checked:r,loose:!1,text:c}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=c.trimRight(),g.raw=g.raw.trimRight();for(var C,k=g.items.length,S=0;S$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]&&t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:e,raw:t[0],href:i,title:s}},i.table=function(t){if(t=this.rules.block.table.exec(t)){var e={type:"table",header:_(t[1]).map((function(t){return{text:t}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];for(var i,s,r,n=e.align.length,a=0;a/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]}},i.link=function(t){if(t=this.rules.inline.link.exec(t)){var e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;var i=E(e.slice(0,-1),"\\");if((e.length-i.length)%2==0)return}else i=function(t,e){if(-1!==t.indexOf(e[1]))for(var i=t.length,s=0,r=0;r$/.test(e)?i.slice(1):i.slice(1,-1):i)&&i.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}},i.reflink=function(t,e){var i;if(i=(i=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t))return(t=e[(t=(i[2]||i[1]).replace(/\s+/g," ")).toLowerCase()])?P(i,t,i[0],this.lexer):{type:"text",raw:e=i[0].charAt(0),text:e}},i.emStrong=function(t,e,i){void 0===i&&(i="");var s=this.rules.inline.emStrong.lDelim.exec(t);if(s&&(!s[3]||!i.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDCD0-\uDCEB\uDCF0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/))&&(!s[1]&&!s[2]||""===i||this.rules.inline.punctuation.exec(i))){var r=s[0].length-1,n=r,a=0,o="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(o.lastIndex=0,e=e.slice(-1*t.length+r);null!=(s=o.exec(e));){var h,l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(l)if(h=l.length,s[3]||s[4])n+=h;else if((s[5]||s[6])&&r%3&&!((r+h)%3))a+=h;else if(!(0<(n-=h)))return h=Math.min(h,h+n+a),l=t.slice(0,r+s.index+(s[0].length-l.length)+h),Math.min(r,h)%2?(h=l.slice(1,-1),{type:"em",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}):(h=l.slice(2,-2),{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)})}}},i.codespan=function(t){var e,i,s;if(t=this.rules.inline.code.exec(t))return s=t[2].replace(/\n/g," "),e=/[^ ]/.test(s),i=/^ /.test(s)&&/ $/.test(s),s=d(s=e&&i?s.substring(1,s.length-1):s,!0),{type:"codespan",raw:t[0],text:s}},i.br=function(t){if(t=this.rules.inline.br.exec(t))return{type:"br",raw:t[0]}},i.del=function(t){if(t=this.rules.inline.del.exec(t))return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}},i.autolink=function(t,e){var i;if(t=this.rules.inline.autolink.exec(t))return e="@"===t[2]?"mailto:"+(i=d(this.options.mangle?e(t[1]):t[1])):i=d(t[1]),{type:"link",raw:t[0],text:i,href:e,tokens:[{type:"text",raw:i,text:i}]}},i.url=function(t,e){var i,s,r,n;if(i=this.rules.inline.url.exec(t)){if("@"===i[2])r="mailto:"+(s=d(this.options.mangle?e(i[0]):i[0]));else{for(;n=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0],n!==i[0];);s=d(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}},i.inlineText=function(t,e){if(t=this.rules.inline.text.exec(t))return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]:d(this.options.smartypants?e(t[0]):t[0]),{type:"text",raw:t[0],text:e}},e}(),M={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:w,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},D=(M.def=v(M.def).replace("label",M._label).replace("title",M._title).getRegex(),M.bullet=/(?:[*+-]|\d{1,9}[.)])/,M.listItemStart=v(/^( *)(bull) */).replace("bull",M.bullet).getRegex(),M.list=v(M.list).replace(/bull/g,M.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+M.def.source+")").getRegex(),M._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",M._comment=/|$)/,M.html=v(M.html,"i").replace("comment",M._comment).replace("tag",M._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),M.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.blockquote=v(M.blockquote).replace("paragraph",M.paragraph).getRegex(),M.normal=i({},M),M.gfm=i({},M.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),M.gfm.table=v(M.gfm.table).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.gfm.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",M.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.pedantic=i({},M.normal,{html:v("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",M._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:w,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(M.normal._paragraph).replace("hr",M.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",M.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:w,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:w,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",D.punctuation=v(D.punctuation).replace(/punctuation/g,D._punctuation).getRegex(),D.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,D.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,D._comment=v(M._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),D.emStrong.lDelim=v(D.emStrong.lDelim).replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimAst=v(D.emStrong.rDelimAst,"g").replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimUnd=v(D.emStrong.rDelimUnd,"g").replace(/punct/g,D._punctuation).getRegex(),D._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,D._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,D._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,D.autolink=v(D.autolink).replace("scheme",D._scheme).replace("email",D._email).getRegex(),D._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,D.tag=v(D.tag).replace("comment",D._comment).replace("attribute",D._attribute).getRegex(),D._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,D._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,D.link=v(D.link).replace("label",D._label).replace("href",D._href).replace("title",D._title).getRegex(),D.reflink=v(D.reflink).replace("label",D._label).replace("ref",M._label).getRegex(),D.nolink=v(D.nolink).replace("ref",M._label).getRegex(),D.reflinkSearch=v(D.reflinkSearch,"g").replace("reflink",D.reflink).replace("nolink",D.nolink).getRegex(),D.normal=i({},D),D.pedantic=i({},D.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",D._label).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D._label).getRegex()}),D.gfm=i({},D.normal,{escape:v(D.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\'+(i?t:d(t,!0))+"\n":"
"+(i?t:d(t,!0))+"
\n"},i.blockquote=function(t){return"
\n"+t+"
\n"},i.html=function(t,e){return t},i.heading=function(t,e,i,s){return this.options.headerIds?"'+t+"\n":""+t+"\n"},i.hr=function(){return this.options.xhtml?"
\n":"
\n"},i.list=function(t,e,i){var s=e?"ol":"ul";return"<"+s+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"},i.listitem=function(t){return"
  • "+t+"
  • \n"},i.checkbox=function(t){return" "},i.paragraph=function(t){return"

    "+t+"

    \n"},i.table=function(t,e){return"\n\n"+t+"\n"+(e=e&&""+e+"")+"
    \n"},i.tablerow=function(t){return"\n"+t+"\n"},i.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"\n"},i.strong=function(t){return""+t+""},i.em=function(t){return""+t+""},i.codespan=function(t){return""+t+""},i.br=function(){return this.options.xhtml?"
    ":"
    "},i.del=function(t){return""+t+""},i.link=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t='"+i+"")},i.image=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t=''+i+'":">"))},i.text=function(t){return t},e}(),B=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),I=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,s=0;if(this.seen.hasOwnProperty(i))for(s=this.seen[t];i=t+"-"+ ++s,this.seen.hasOwnProperty(i););return e||(this.seen[t]=s,this.seen[i]=0),i},e.slug=function(t,e){return void 0===e&&(e={}),t=this.serialize(t),this.getNextSafeSlug(t,e.dryrun)},t}(),j=function(){function e(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new B,this.slugger=new I}e.parse=function(t,i){return new e(i).parse(t)},e.parseInline=function(t,i){return new e(i).parseInline(t)};var i=e.prototype;return i.parse=function(t,e){void 0===e&&(e=!0);for(var i,s,r,n,a,o,h,l,u,c,d,p,f,v,m,y,b="",x=t.length,C=0;C",o?Promise.resolve(e):h?void h(null,e):e;if(o)return Promise.reject(t);if(!h)throw t;h(t)});if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(u=n,(l=r)&&!l.silent&&(u&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(l.sanitize||l.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),!l.highlight&&"language-"===l.langPrefix||console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),l.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),l.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),l.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),l.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),l.headerIds||l.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."),r.hooks&&(r.hooks.options=r),n){var p,g=r.highlight;try{r.hooks&&(s=r.hooks.preprocess(s)),p=t(s,r)}catch(s){return c(s)}var f,v=function(t){var i;if(!t)try{r.walkTokens&&G.walkTokens(p,r.walkTokens),i=e(p,r),r.hooks&&(i=r.hooks.postprocess(i))}catch(i){t=i}return r.highlight=g,t?c(t):n(null,i)};return!g||g.length<3?v():(delete r.highlight,p.length?(f=0,G.walkTokens(p,(function(t){"code"===t.type&&(f++,setTimeout((function(){g(t.text,t.lang,(function(e,i){if(e)return v(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0==--f&&v()}))}),0))})),void(0===f&&v())):v())}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then((function(e){return t(e,r)})).then((function(t){return r.walkTokens?Promise.all(G.walkTokens(t,r.walkTokens)).then((function(){return t})):t})).then((function(t){return e(t,r)})).then((function(t){return r.hooks?r.hooks.postprocess(t):t})).catch(c);try{r.hooks&&(s=r.hooks.preprocess(s));var m=t(s,r),y=(r.walkTokens&&G.walkTokens(m,r.walkTokens),e(m,r));return r.hooks?r.hooks.postprocess(y):y}catch(s){return c(s)}}}function G(t,e,i){return N(R.lex,j.parse)(t,e,i)}z.passThroughHooks=new Set(["preprocess","postprocess"]),G.options=G.setOptions=function(e){return G.defaults=i({},G.defaults,e),e=G.defaults,t.defaults=e,G},G.getDefaults=n,G.defaults=t.defaults,G.use=function(){for(var t=G.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,s=new Array(e),r=0;r0?(n=new z,t.paragraphs.length>0&&n.addChild(sr(t,e)),rr(t.children,e,n)):n=sr(t,e),n;switch(u.type){case"if":var c=new j({title:"[if]"}),d=nr(u.match[1],t);try{f=new V({expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({expression:"false"})}t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),c.addChild(f);var p=new F;return c.addChild(p),c;case"else":case"else if":var g=u.type;d="else"===g?"true":nr(u.match[1],t);try{f=new V({title:`[${g}]`,expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:`[${g}]`,expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),f;case"while":var f,v=new $({title:"[while]",returnSuccess:!0});d=nr(u.match[1],t);try{f=new V({title:"[while-IF]",expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:"[while-IF]",expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),v.addChild(f),v;case"repeat":var m=(l=u.match[1]).startsWith("#(")&&l.endsWith(")")?l.substring(2,l.length-1):l,y=new X({title:"[repeat]",maxLoop:m});return t.children.length>0?y.addChild(rr(t.children,e)):y.addChild(sr(t,e)),y;default:console.error(`Missing ${u.type}'s handler`)}},nr=function(t,e){var i=t.trim();return""===i&&(i=Js(e)),i},ar=function(t,e,{groupName:i,lineBreak:s="\\",commentLineStart:r="//",parallel:n=!1,active:a=!0,once:o=!1}={}){var h=function(t){for(var e=Gs.lexer(t),i=null,s=[],r=0;r0?v.addChild(rr(c[0],p)):v.addChild(new F),f.addChild(v),g};class or extends Is{boot(){super.boot(),this.scene&&this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(t){if(!this.isShutdown)return this.scene&&this.scene.sys.events.off("shutdown",this.destroy,this),super.shutdown(t),this}addEventSheet(t,e,i){"string"!=typeof e&&(i=e,e=void 0),void 0===e&&(e=this.defaultTreeGroupName),void 0===i&&(i={});var{lineBreak:s="\\",commentLineStart:r="//",parallel:n=this.parallel,groupName:e=e}=i,a=ar(this,t,{groupName:e,lineBreak:s,commentLineStart:r,parallel:n});return this.addTree(a,a.groupName),this}} + */,Repeat:W,RepeatUntilFailure:$,RepeatUntilSuccess:class extends R{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="RepeatUntilSuccess"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s=r;if(n){e.$lastEndTime=i;r=t.evalExpression(this.intervalExpression);var a=t.evalExpression(this.randomDeviationExpression);a>0&&(r+=(.5-Math.random())*a),e.$interval=r}return n}},ShuffleSelector:class extends L{constructor({children:t=[],services:e,title:i,name:s="ShuffleSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){var e=this.getNodeMemory(t);e.$runningChild=0,e.$children||(e.$children=this.children.map(((t,e)=>e))),function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}}(e.$children)}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=i.$children,n=s,a=r.length;n=e.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(t)}},Wait:class extends A{constructor({duration:t=0,services:e,title:i,name:s="Wait"}={}){super({title:i,name:s,properties:{duration:t},services:e}),this.durationExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$startTime,r=e.$duration;if(r>0){if(i-st.id)),r.services&&(n.services=r.services.map((t=>t.id)));break;case o:r.child&&(n.child=r.child.id);break;case h:r.services&&(n.services=r.services.map((t=>t.id)))}t.nodes.push(n)}return t},load:function(t,e){var i=t.sn;null!=i&&p(Math.max(g(),i)),e=e||{},this.title=t.title||this.title,this.description=t.description||this.description,this.properties=t.properties||this.properties;for(var s=t.nodes,r={},n=s.length-1;n>=0;n--){var a,o=s[n],h=o.name;if(h in e)a=e[h];else{if(!(h in H))throw new EvalError(`BehaviorTree.load: Invalid node name "${h}".`);a=H[h]}var l={};o.hasOwnProperty("children")&&(l.children=o.children),o.hasOwnProperty("child")&&(l.child=o.child),o.hasOwnProperty("services")&&(l.services=o.services);var u=new a(l=Object.assign(l,o.properties),r);u.id=o.id||u.id,u.title=o.title||u.title,u.description=o.description||u.description,u.properties=o.properties||u.properties,r[u.id]=u}return this.root=r[t.root],this}};Object.assign(q.prototype,K,v);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(J(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(J(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n0&&(G(this.trees,e),G(this.pendingTrees,e)),this}},lt={getTreeActiveState(t){var e=this.getTree(t);return e?e.active:null},setTreeActiveState(t,e){var i=this.getTree(t);return i&&i.setActive(e),this}};class ut extends z{open(t){super.open(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.enter",this.title,i.title,s.name,e)}tick(t){var e=super.tick(t);return 2===e&&(e=1),e}close(t){super.close(t);var e=t.blackboard.eventSheetManager,i=t.tree,s=i.eventSheetGroup;e.emit("label.exit",this.title,i.title,s.name,e)}}var ct={pauseEventSheet(t){var e=t.tree.eventSheetGroup;this.isRunning=!0;var i=this,s=this.waitId;return function(){s":">",'"':""","'":"'","/":"/","`":"`","=":"="};var Ct=/\s*/,kt=/\s+/,St=/\s*=/,wt=/\s*\}/,_t=/#|\^|\/|>|\{|&|=|!/;function Et(t){this.string=t,this.tail=t,this.pos=0}function Tt(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Pt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Et.prototype.eos=function(){return""===this.tail},Et.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var i=e[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},Et.prototype.scanUntil=function(t){var e,i=this.tail.search(t);switch(i){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=e.length,e},Tt.prototype.push=function(t){return new Tt(t,this)},Tt.prototype.lookup=function(t){var e,i,s,r=this.cache;if(r.hasOwnProperty(t))e=r[t];else{for(var n,a,o,h=this,l=!1;h;){if(t.indexOf(".")>0)for(n=h.view,a=t.split("."),o=0;null!=n&&o0?r[r.length-1][4]:i;break;default:s.push(e)}return i}(function(t){for(var e,i,s=[],r=0,n=t.length;r"===a?o=this.renderPartial(n,e,i,r):"&"===a?o=this.unescapedValue(n,e):"name"===a?o=this.escapedValue(n,e,r):"text"===a&&(o=this.rawValue(n)),void 0!==o&&(h+=o);return h},Pt.prototype.renderSection=function(t,e,i,s,r){var n=this,a="",o=e.lookup(t[1]);if(o){if(pt(o))for(var h=0,l=o.length;h0||!i)&&(r[n]=s+r[n]);return r.join("\n")},Pt.prototype.renderPartial=function(t,e,i,s){if(i){var r=this.getConfigTags(s),n=gt(i)?i(t[1]):i[t[1]];if(null!=n){var a=t[6],o=t[5],h=t[4],l=n;0==o&&h&&(l=this.indentPartial(n,h,a));var u=this.parse(l,r);return this.renderTokens(u,e,i,l,s)}}},Pt.prototype.unescapedValue=function(t,e){var i=e.lookup(t[1]);if(null!=i)return i},Pt.prototype.escapedValue=function(t,e,i){var s=this.getConfigEscape(i)||Ot.escape,r=e.lookup(t[1]);if(null!=r)return"number"==typeof r&&s===Ot.escape?String(r):s(r)},Pt.prototype.rawValue=function(t){return t[1]},Pt.prototype.getConfigTags=function(t){return pt(t)?t:t&&"object"==typeof t?t.tags:void 0},Pt.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!pt(t)?t.escape:void 0};var Ot={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Mt.templateCache=t},get templateCache(){return Mt.templateCache}},Mt=new Pt;Ot.clearCache=function(){return Mt.clearCache()},Ot.parse=function(t,e){return Mt.parse(t,e)},Ot.render=function(t,e,i,s){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+((pt(r=t)?"array":typeof r)+'" was given as the first argument for mustache#render(template, view, partials)'));var r;return Mt.render(t,e,i,s)},Ot.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return xt[t]}))},Ot.Scanner=Et,Ot.Context=Tt,Ot.Writer=Pt;class Dt extends A{constructor(t){super({name:"TaskAction",title:t.name,properties:t});var e=t.parameters,i={};for(var s in e)i[s]=At(e[s]);this.taskParameters=i,this.isRunning=!1,this.waitId=0}open(t){this.isRunning=!1;var e=this.properties.name;if(e){var i=t.blackboard.eventSheetManager,s=t.tree,r=i.memory,n=this.taskParameters,a={};for(var o in n){var h=n[o];"function"==typeof h&&(h=h(r)),a[o]=h}i.bindTaskActionNode(t,this);var l,u,c=t.target,d=c[e];d?l=d.call(c,a,i,s):(d=c.defaultHandler)&&(l=d.call(c,e,a,i,s)),i.unBindTaskAction(t,this),!this.isRunning&&((u=l)&&"object"==typeof u&&u.on)&&this.pauseEventSheetUnitlEvent(t,l)}}tick(t){return this.isRunning?this.RUNNING:this.SUCCESS}close(t){}abort(t){this.removeTaskCompleteCallback&&this.removeTaskCompleteCallback()}}var At=function(t){if("string"==typeof t)if(t.startsWith("#(")&&t.endsWith(")"))t=E(t.substring(2,t.length-1));else if(t.indexOf("{{")>-1&&t.indexOf("}}")>-1){var e=t;t=function(t){return Ot.render(e,t)}}return t};Object.assign(Dt.prototype,ct);class Lt extends A{constructor({activateTreeTitle:t,services:e,title:i,name:s="ActivateTree"}={}){super({name:s,title:i,properties:{activateTreeTitle:t},services:e}),this.activateTreeTitle=t}tick(t){var e=this.getTree(t);return this.activateTreeTitle&&""!==this.activateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.activateTreeTitle,e.groupName,!0):e.setActive(!0),this.SUCCESS}}class Rt extends A{constructor({deactivateTreeTitle:t,services:e,title:i,name:s="DeactivateTree"}={}){super({name:s,title:i,properties:{deactivateTreeTitle:t},services:e}),this.deactivateTreeTitle=t}tick(t){var e=this.getTree(t);return this.deactivateTreeTitle&&""!==this.deactivateTreeTitle?e.eventSheetManager.setEventSheetActiveState(this.deactivateTreeTitle,e.groupName,!1):e.setActive(!1),this.SUCCESS}}var Ft={TaskSequence:ut,TaskAction:Dt,ActivateAction:Lt,DeactivateAction:Rt},Bt={dumpEventSheetGroup(){return this.trees.map((function(t){return t.dump()}))},loadEventSheetGroup(t){return t.forEach((function(t){var e=new q({id:t.id,title:t.title,properties:y(t.properties)});e.load(t,Ft),this.trees.push(e)}),this),this}},It={dumpState(t=!1){var e={isRunning:this.isRunning,pendingTrees:this.pendingTrees.filter((function(t){return!t.roundComplete})).map((function(t){return t.id}))};return t&&(e.trees=this.dumpEventSheetGroup()),e},loadState(t){this.stop(),t.trees&&(this.trees.length=0,this.loadEventSheetGroup(t.trees)),this.isRunning=t.isRunning;var e=this.pendingTrees;return e.length=0,this.trees.forEach((function(i){t.pendingTrees.indexOf(i.id)>-1&&e.push(i)})),this}},jt=function(t,e){var i=t.blackboard,s=t.commandExecutor;e.start(i,s)&&(e.conditionPassed?t.emit("eventsheet.enter",e.title,this.name,t):t.emit("eventsheet.catch",e.title,this.name,t))},zt=function(t,e){var i=t.blackboard,s=t.commandExecutor;return e.tick(i,s)},Nt=function(t,e){e.conditionPassed&&t.emit("eventsheet.exit",e.title,this.name,t)},Gt={start(){if(this.isRunning)return this;this.isRunning=!0;var t=this.parent,e=this.trees,i=this.pendingTrees,s=t.blackboard;t.emit("start",this.name,t);for(var r=0,n=e.length;r0&&G(e,i),0===e.length&&(this.isRunning=!1,t.emit("complete",this.name,t)),this},startTree(t,e=!0){if(this.isRunning)return this;var i=this.getTree(t);if(!i)return this;this.isRunning=!0;var s=this.parent,r=this.pendingTrees,n=s.blackboard;return r.length=0,i.resetState(n),i.setConditionEnable(!e),jt.call(this,s,i),i.setConditionEnable(!0),r.push(i),this.continue(),this}},Yt={stop(){for(var t=this.parent,e=t.blackboard,i=t.commandExecutor,s=this.pendingTrees,r=0,n=s.length;r":">",'"':""","'":"'","`":"`","=":"="},se=/[&<>"'`=]/g,re=/[&<>"'`=]/;function ne(t){return ie[t]}function ae(t){for(var e=1;e0?(s.ids&&(s.ids=[s.name]),t.helpers.each(e,s)):r(this);if(s.data&&s.ids){var a=i.createFrame(s.data);a.contextPath=i.appendContextPath(s.data.contextPath,s.name),s={data:a}}return n(e,s)}))},t.exports=e.default}(pe,pe.exports);var ge=pe.exports,fe={exports:{}};!function(t,e){e.__esModule=!0;var i,s=ee,r=(i=ce)&&i.__esModule?i:{default:i};e.default=function(t){t.registerHelper("each",(function(t,e){if(!e)throw new r.default("Must pass iterator to #each");var i,n=e.fn,a=e.inverse,o=0,h="",l=void 0,u=void 0;function c(e,i,r){l&&(l.key=e,l.index=i,l.first=0===i,l.last=!!r,u&&(l.contextPath=u+e)),h+=n(t[e],{data:l,blockParams:s.blockParams([t[e],e],[u+e,null])})}if(e.data&&e.ids&&(u=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),s.isFunction(t)&&(t=t.call(this)),e.data&&(l=s.createFrame(e.data)),t&&"object"==typeof t)if(s.isArray(t))for(var d=t.length;o=0?e:parseInt(t,10)}return t},log:function(t){if(t=s.lookupLevel(t),"undefined"!=typeof console&&s.lookupLevel(s.level)<=t){var e=s.methodMap[t];console[e]||(e="log");for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var ii="[object Object]";function si(t,e,i){this.helpers=t||{},this.partials=e||{},this.decorators=i||{},Ze.registerDefaultHelpers(this),Qe.registerDefaultDecorators(this)}si.prototype={constructor:si,logger:ti.default,log:ti.default.log,registerHelper:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple helpers");Ke.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(Ke.toString.call(t)===ii)Ke.extend(this.partials,t);else{if(void 0===e)throw new Je.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(Ke.toString.call(t)===ii){if(e)throw new Je.default("Arg not supported with multiple decorators");Ke.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){ei.resetLoggedProperties()}};var ri=ti.default.log;te.log=ri,te.createFrame=Ke.createFrame,te.logger=ti.default;var ni={exports:{}};!function(t,e){function i(t){this.string=t}e.__esModule=!0,i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},e.default=i,t.exports=e.default}(ni,ni.exports);var ai=ni.exports,oi={},hi={};hi.__esModule=!0,hi.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}},oi.__esModule=!0,oi.checkRevision=function(t){var e=t&&t[0]||1,i=ci.COMPILER_REVISION;if(e>=ci.LAST_COMPATIBLE_COMPILER_REVISION&&e<=ci.COMPILER_REVISION)return;if(e2&&y.push("'"+this.terminals_[f]+"'");C=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[c]||c)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==c?"end of input":"'"+(this.terminals_[c]||c)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[c]||c,line:this.lexer.yylineno,loc:l,expected:y})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+c);switch(p[0]){case 1:i.push(c),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(p[1]),c=null,h=this.lexer.yyleng,a=this.lexer.yytext,o=this.lexer.yylineno,l=this.lexer.yylloc;break;case 2:if(v=this.productions_[p[1]][1],x.$=s[s.length-v],x._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},u&&(x._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),void 0!==(g=this.performAction.call(x,a,h,o,this.yy,p[1],s,r)))return g;v&&(i=i.slice(0,-1*v*2),s=s.slice(0,-1*v),r=r.slice(0,-1*v)),i.push(this.productions_[p[1]][0]),s.push(x.$),r.push(x._$),m=n[i[i.length-2]][i[i.length-1]],i.push(m);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;ae[0].length)||(e=i,s=a,this.options.flex));a++);return e?((r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){function r(t,i){return e.yytext=e.yytext.substring(t,e.yyleng-i+t)}switch(i){case 0:if("\\\\"===e.yytext.slice(-2)?(r(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(r(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(r(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=r(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=r(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function i(){this.yy={}}return t.lexer=e,i.prototype=t,t.Parser=i,new i}();e.default=i,t.exports=e.default}(wi,wi.exports);var _i=wi.exports,Ei={exports:{}},Ti={exports:{}};!function(t,e){e.__esModule=!0;var i=function(t){return t&&t.__esModule?t:{default:t}}(ce);function s(){this.parents=[]}function r(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function n(t){r.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function a(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var r=this.accept(t[e]);if(this.mutating){if(r&&!s.prototype[r.type])throw new i.default('Unexpected node type "'+r.type+'" found when accepting '+e+" on "+t.type);t[e]=r}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new i.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,i=t.length;e0)throw new Di.default("Invalid path: "+s,{loc:i});".."===h&&n++}}return{type:"PathExpression",data:t,depth:n,parts:r,original:s,loc:i}},Mi.prepareMustache=function(t,e,i,s,r,n){var a=s.charAt(3)||s.charAt(2),o="{"!==a&&"&"!==a;return{type:/\*/.test(s)?"Decorator":"MustacheStatement",path:t,params:e,hash:i,escaped:o,strip:r,loc:this.locInfo(n)}},Mi.prepareRawBlock=function(t,e,i,s){Ai(t,i),s=this.locInfo(s);var r={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:r,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}},Mi.prepareBlock=function(t,e,i,s,r,n){s&&s.path&&Ai(t,s);var a=/\*/.test(t.open);e.blockParams=t.blockParams;var o=void 0,h=void 0;if(i){if(a)throw new Di.default("Unexpected inverse block on decorator",i);i.chain&&(i.program.body[0].closeStrip=s.strip),h=i.strip,o=i.program}r&&(r=o,o=e,e=r);return{type:a?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:o,openStrip:t.strip,inverseStrip:h,closeStrip:s&&s.strip,loc:this.locInfo(n)}},Mi.prepareProgram=function(t,e){if(!e&&t.length){var i=t[0].loc,s=t[t.length-1].loc;i&&s&&(e={source:i.source,start:{line:i.start.line,column:i.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},Mi.preparePartialBlock=function(t,e,i,s){return Ai(t,i),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:i&&i.strip,loc:this.locInfo(s)}};var Di=function(t){return t&&t.__esModule?t:{default:t}}(ce);function Ai(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var i={loc:t.path.loc};throw new Di.default(t.path.original+" doesn't match "+e,i)}}function Li(t){return t&&t.__esModule?t:{default:t}}Si.__esModule=!0,Si.parseWithoutProcessing=zi,Si.parse=function(t,e){var i=zi(t,e);return new Fi.default(e).accept(i)};var Ri=Li(_i),Fi=Li(Oi),Bi=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(Mi),Ii=ee;Si.parser=Ri.default;var ji={};function zi(t,e){return"Program"===t.type?t:(Ri.default.yy=ji,ji.locInfo=function(t){return new ji.SourceLocation(e&&e.srcName,t)},Ri.default.parse(t))}Ii.extend(ji,Bi);var Ni={};function Gi(t){return t&&t.__esModule?t:{default:t}}Ni.__esModule=!0,Ni.Compiler=Vi,Ni.precompile=function(t,e,i){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var s=i.parse(t,e),r=(new i.Compiler).compile(s,e);return(new i.JavaScriptCompiler).compile(r,e)},Ni.compile=function(t,e,i){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new Yi.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=Xi.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var s=void 0;function r(){var s=i.parse(t,e),r=(new i.Compiler).compile(s,e),n=(new i.JavaScriptCompiler).compile(r,e,void 0,!0);return i.template(n)}function n(t,e){return s||(s=r()),s.call(this,t,e)}return n._setup=function(t){return s||(s=r()),s._setup(t)},n._child=function(t,e,i,n){return s||(s=r()),s._child(t,e,i,n)},n};var Yi=Gi(ce),Xi=ee,Wi=Gi(ki),$i=[].slice;function Vi(){}function Hi(t,e){if(t===e)return!0;if(Xi.isArray(t)&&Xi.isArray(e)&&t.length===e.length){for(var i=0;i1)throw new Yi.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var s=t.name.original,r="SubExpression"===t.name.type;r&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var n=t.indent||"";this.options.preventIndent&&n&&(this.opcode("appendContent",n),n=""),this.opcode("invokePartial",r,s,n),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Ui(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var s=t.path,r=s.parts[0],n=null!=e||null!=i;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",r,n)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var s=this.setupFullMustacheParams(t,e,i),r=t.path,n=r.parts[0];if(this.options.knownHelpers[n])this.opcode("invokeKnownHelper",s.length,n);else{if(this.options.knownHelpersOnly)throw new Yi.default("You specified knownHelpersOnly, but used the unknown helper "+n,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",s.length,r.original,Wi.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=Wi.default.helpers.scopedId(t),s=!t.depth&&!i&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,s=e.length;for(this.opcode("pushHash");i=0)return[e,r]}}};var qi,Ki,Ji={exports:{}},Zi={exports:{}},Qi={},ts={},es={},is={};function ss(){if(qi)return is;qi=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return is.encode=function(e){if(0<=e&&e>>=5)>0&&(i|=32),s+=t.encode(i)}while(r>0);return s},es.decode=function(e,i,s){var r,n,a,o,h=e.length,l=0,u=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=t.decode(e.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+e.charAt(i-1));r=!!(32&n),l+=(n&=31)<>1,1&~a?o:-o),s.rest=i},es}var ns,as={};function os(){return ns||(ns=1,function(t){t.getArg=function(t,e,i){if(e in t)return t[e];if(3===arguments.length)return i;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function s(t){var i=t.match(e);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function r(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function n(e){var i=e,n=s(e);if(n){if(!n.path)return e;i=n.path}for(var a,o=t.isAbsolute(i),h=i.split(/\/+/),l=0,u=h.length-1;u>=0;u--)"."===(a=h[u])?h.splice(u,1):".."===a?l++:l>0&&(""===a?(h.splice(u+1,l),l=0):(h.splice(u,2),l--));return""===(i=h.join("/"))&&(i=o?"/":"."),n?(n.path=i,r(n)):i}function a(t,e){""===t&&(t="."),""===e&&(e=".");var a=s(e),o=s(t);if(o&&(t=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),r(a);if(a||e.match(i))return e;if(o&&!o.host&&!o.path)return o.host=e,r(o);var h="/"===e.charAt(0)?e:n(t.replace(/\/+$/,"")+"/"+e);return o?(o.path=h,r(o)):h}t.urlParse=s,t.urlGenerate=r,t.normalize=n,t.join=a,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var i=0;0!==e.indexOf(t+"/");){var s=t.lastIndexOf("/");if(s<0)return e;if((t=t.slice(0,s)).match(/^([^\/]+:\/)?\/*$/))return e;++i}return Array(i+1).join("../")+e.substr(t.length+1)};var o=!("__proto__"in Object.create(null));function h(t){return t}function l(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var i=e-10;i>=0;i--)if(36!==t.charCodeAt(i))return!1;return!0}function u(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=o?h:function(t){return l(t)?"$"+t:t},t.fromSetString=o?h:function(t){return l(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,i){var s=u(t.source,e.source);return 0!==s||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)||i||0!==(s=t.generatedColumn-e.generatedColumn)||0!==(s=t.generatedLine-e.generatedLine)?s:u(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,i){var s=t.generatedLine-e.generatedLine;return 0!==s||0!==(s=t.generatedColumn-e.generatedColumn)||i||0!==(s=u(t.source,e.source))||0!==(s=t.originalLine-e.originalLine)||0!==(s=t.originalColumn-e.originalColumn)?s:u(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var i=t.generatedLine-e.generatedLine;return 0!==i||0!==(i=t.generatedColumn-e.generatedColumn)||0!==(i=u(t.source,e.source))||0!==(i=t.originalLine-e.originalLine)||0!==(i=t.originalColumn-e.originalColumn)?i:u(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,i){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),i){var o=s(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}e=a(r(o),e)}return n(e)}}(as)),as}var hs,ls={};function us(){if(hs)return ls;hs=1;var t=os(),e=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function s(){this._array=[],this._set=i?new Map:Object.create(null)}return s.fromArray=function(t,e){for(var i=new s,r=0,n=t.length;r=0)return r}else{var n=t.toSetString(s);if(e.call(this._set,n))return this._set[n]}throw new Error('"'+s+'" is not in the set.')},s.prototype.at=function(t){if(t>=0&&tr||n==r&&o>=a||t.compareByGeneratedPositionsInflated(i,s)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},ps.MappingList=e,ps}function fs(){if(ds)return ts;ds=1;var t=rs(),e=os(),i=us().ArraySet,s=gs().MappingList;function r(t){t||(t={}),this._file=e.getArg(t,"file",null),this._sourceRoot=e.getArg(t,"sourceRoot",null),this._skipValidation=e.getArg(t,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}return r.prototype._version=3,r.fromSourceMap=function(t){var i=t.sourceRoot,s=new r({file:t.file,sourceRoot:i});return t.eachMapping((function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=i&&(r.source=e.relative(i,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),s.addMapping(r)})),t.sources.forEach((function(r){var n=r;null!==i&&(n=e.relative(i,r)),s._sources.has(n)||s._sources.add(n);var a=t.sourceContentFor(r);null!=a&&s.setSourceContent(r,a)})),s},r.prototype.addMapping=function(t){var i=e.getArg(t,"generated"),s=e.getArg(t,"original",null),r=e.getArg(t,"source",null),n=e.getArg(t,"name",null);this._skipValidation||this._validateMapping(i,s,r,n),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=s&&s.line,originalColumn:null!=s&&s.column,source:r,name:n})},r.prototype.setSourceContent=function(t,i){var s=t;null!=this._sourceRoot&&(s=e.relative(this._sourceRoot,s)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(s)]=i):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(s)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(t,s,r){var n=s;if(null==s){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=t.file}var a=this._sourceRoot;null!=a&&(n=e.relative(a,n));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===n&&null!=i.originalLine){var s=t.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=s.source&&(i.source=s.source,null!=r&&(i.source=e.join(r,i.source)),null!=a&&(i.source=e.relative(a,i.source)),i.originalLine=s.line,i.originalColumn=s.column,null!=s.name&&(i.name=s.name))}var l=i.source;null==l||o.has(l)||o.add(l);var u=i.name;null==u||h.has(u)||h.add(u)}),this),this._sources=o,this._names=h,t.sources.forEach((function(i){var s=t.sourceContentFor(i);null!=s&&(null!=r&&(i=e.join(r,i)),null!=a&&(i=e.relative(a,i)),this.setSourceContent(i,s))}),this)},r.prototype._validateMapping=function(t,e,i,s){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||i||s)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:i,original:e,name:s}))},r.prototype._serializeMappings=function(){for(var i,s,r,n,a=0,o=1,h=0,l=0,u=0,c=0,d="",p=this._mappings.toArray(),g=0,f=p.length;g0){if(!e.compareByGeneratedPositionsInflated(s,p[g-1]))continue;i+=","}i+=t.encode(s.generatedColumn-a),a=s.generatedColumn,null!=s.source&&(n=this._sources.indexOf(s.source),i+=t.encode(n-c),c=n,i+=t.encode(s.originalLine-1-l),l=s.originalLine-1,i+=t.encode(s.originalColumn-h),h=s.originalColumn,null!=s.name&&(r=this._names.indexOf(s.name),i+=t.encode(r-u),u=r)),d+=i}return d},r.prototype._generateSourcesContent=function(t,i){return t.map((function(t){if(!this._sourcesContents)return null;null!=i&&(t=e.relative(i,t));var s=e.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null}),this)},r.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},ts.SourceMapGenerator=r,ts}var vs,ms={},ys={};function bs(){return vs||(vs=1,function(t){function e(i,s,r,n,a,o){var h=Math.floor((s-i)/2)+i,l=a(r,n[h],!0);return 0===l?h:l>0?s-h>1?e(h,s,r,n,a,o):o==t.LEAST_UPPER_BOUND?s1?e(i,h,r,n,a,o):o==t.LEAST_UPPER_BOUND?h:i<0?-1:i}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(i,s,r,n){if(0===s.length)return-1;var a=e(-1,s.length,i,s,r,n||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===r(s[a],s[a-1],!0);)--a;return a}}(ys)),ys}var xs,Cs,ks={};function Ss(){if(xs)return ks;function t(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function e(i,s,r,n){if(r=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var l=o.originalColumn;o&&o.originalLine===s&&o.originalColumn==l;)n.push({line:t.getArg(o,"generatedLine",null),column:t.getArg(o,"generatedColumn",null),lastColumn:t.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return n},ms.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(e){var i,s=e;if(null!=this.sourceRoot&&(s=t.relative(this.sourceRoot,s)),this._sources.has(s))return this._sources.indexOf(s);for(i=0;i1&&(n.source=f+h[1],f+=h[1],n.originalLine=p+h[2],p=n.originalLine,n.originalLine+=1,n.originalColumn=g+h[3],g=n.originalColumn,h.length>4&&(n.name=v+h[4],v+=h[4])),k.push(n),"number"==typeof n.originalLine&&C.push(n)}r(k,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,r(C,t.compareByOriginalPositions),this.__originalMappings=C},a.prototype._findMapping=function(t,i,s,r,n,a){if(t[s]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[s]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return e.search(t,i,n,a)},a.prototype.computeColumnSpans=function(){for(var t=0;t=0){var r=this._generatedMappings[s];if(r.generatedLine===i.generatedLine){var a=t.getArg(r,"source",null);null!==a&&(a=this._sources.at(a),a=t.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=t.getArg(r,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:t.getArg(r,"originalLine",null),column:t.getArg(r,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t}))},a.prototype.sourceContentFor=function(e,i){if(!this.sourcesContent)return null;var s=this._findSourceIndex(e);if(s>=0)return this.sourcesContent[s];var r,n=e;if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var a=n.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!r.path||"/"==r.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(i)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(e){var i=t.getArg(e,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var s={source:i,originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")},r=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var a=this._originalMappings[r];if(a.source===s.source)return{line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},ms.BasicSourceMapConsumer=a,h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var t=[],e=0;e=0;e--)this.prepend(t[e]);else{if(!t[s]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},r.prototype.walk=function(t){for(var e,i=0,r=this.children.length;i0){for(e=[],i=0;i0&&(i+=", "+s.join(", "));var r=0;Object.keys(this.aliases).forEach((function(t){var s=e.aliases[t];s.children&&s.referenceCount>1&&(i+=", alias"+ ++r+"="+t,s.children[0]="alias"+r)})),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var n=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths");var a=this.mergeSource(i);return t?(n.push(a),Function.apply(this,n)):this.source.wrap(["function(",n.join(","),") {\n ",a,"}"])},mergeSource:function(t){var e=this.environment.isSimple,i=!this.forceBuffer,s=void 0,r=void 0,n=void 0,a=void 0;return this.source.each((function(t){t.appendToBuffer?(n?t.prepend(" + "):n=t,a=t):(n&&(r?n.prepend("buffer += "):s=!0,a.add(";"),n=a=void 0),r=!0,e||(i=!1))})),i?n?(n.prepend("return "),a.add(";")):r||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),n?(n.prepend("return buffer + "),a.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var s=this.popStack();i.splice(1,0,s),this.push(this.source.functionCall(e,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var i=this.topStack();e.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack((function(t){return[" != null ? ",t,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,i,s){var r=0;s||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[r++])),this.resolvePath("context",t,r,e,i)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,i)},resolvePath:function(t,e,i,s,r){var n=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,i,s,r){var n=e.popStack(),a=i.length;t&&a--;for(;sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,i=t.length;ee[t],set(i){e[t]=i},enumerable:!0,configurable:!0}),this}setTreeGroup(t){return this.groupName=t,this.eventSheetGroup=this.eventSheetManager.getTreeGroup(t),this}setActive(t){return void 0===t&&(t=!0),this.active=t,this}get roundComplete(){return 2===this.roundState}set roundComplete(t){this.roundState=t?2:1}setConditionEnable(t=!0){var e=t?void 0:0;return this.root.setSelectChildIndex(e),this}start(t,e){if(1===this.roundState)return!1;var i=3!==this.getState(t);if(i&&this.resetState(t),this.roundState=1,super.tick(t,e),i){var s=this.root.getNodeMemory(this.ticker);this.conditionPassed=0===s.$runningChild}return!0}tick(t,e){var i=super.tick(t,e);return 3!==i&&(this.roundState=2,this.conditionPassed&&this.properties.once&&this.setActive(!1)),i}abort(t,e){this.roundState=0,super.abort(t,e)}}var Ns={exports:{}};!function(t,e){!function(t){function e(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,s=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function a(t){return c[t]}t.defaults=n();var o=/[&<>"']/,h=new RegExp(o.source,"g"),l=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,u=new RegExp(l.source,"g"),c={"&":"&","<":"<",">":">",'"':""","'":"'"};function d(t,e){if(e){if(o.test(t))return t.replace(h,a)}else if(l.test(t))return t.replace(u,a);return t}var p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(t){return t.replace(p,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var f=/(^|[^\[])\^/g;function v(t,e){t="string"==typeof t?t:t.source,e=e||"";var i={replace:function(e,s){return s=(s=s.source||s).replace(f,"$1"),t=t.replace(e,s),i},getRegex:function(){return new RegExp(t,e)}};return i}var m=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(t,e,i){if(t){try{s=decodeURIComponent(g(i)).replace(m,"").toLowerCase()}catch(t){return null}if(0===s.indexOf("javascript:")||0===s.indexOf("vbscript:")||0===s.indexOf("data:"))return null}var s;e&&!y.test(i)&&(t=i,x[" "+(s=e)]||(C.test(s)?x[" "+s]=s+"/":x[" "+s]=E(s,"/",!0)),e=-1===(s=x[" "+s]).indexOf(":"),i="//"===t.substring(0,2)?e?t:s.replace(k,"$1")+t:"/"===t.charAt(0)?e?t:s.replace(S,"$1")+t:s+t);try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var x={},C=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,S=/^([^:]+:\/*[^/]*)[\s\S]*$/,w={exec:function(){}};function _(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var s=!1,r=e;0<=--r&&"\\"===i[r];)s=!s;return s?"|":" |"})).split(/ \|/),s=0;if(i[0].trim()||i.shift(),0e)i.splice(e);else for(;i.length>=1,t+=t;return i+t}function P(t,e,i,s){var r=e.href,n=(e=e.title?d(e.title):null,t[1].replace(/\\([\[\]])/g,"$1"));return"!"!==t[0].charAt(0)?(s.state.inLink=!0,t={type:"link",raw:i,href:r,title:e,text:n,tokens:s.inlineTokens(n)},s.state.inLink=!1,t):{type:"image",raw:i,href:r,title:e,text:d(n)}}var O=function(){function e(e){this.options=e||t.defaults}var i=e.prototype;return i.space=function(t){if((t=this.rules.block.newline.exec(t))&&0=r.length?t.slice(r.length):t})).join("\n")),{type:"code",raw:e,lang:t[2]&&t[2].trim().replace(this.rules.inline._escapes,"$1"),text:i}},i.heading=function(t){var e,i;if(t=this.rules.block.heading.exec(t))return e=t[2].trim(),/#$/.test(e)&&(i=E(e,"#"),!this.options.pedantic&&i&&!/ $/.test(i)||(e=i.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}},i.hr=function(t){if(t=this.rules.block.hr.exec(t))return{type:"hr",raw:t[0]}},i.blockquote=function(t){var e,i,s;if(t=this.rules.block.blockquote.exec(t))return e=t[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top,this.lexer.state.top=!0,s=this.lexer.blockTokens(e),this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}},i.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,s,r,n,a,o,h,l,u,c,d,p=1<(f=e[1].trim()).length,g={type:"list",raw:"",ordered:p,start:p?+f.slice(0,-1):"",loose:!1,items:[]},f=p?"\\d{1,9}\\"+f.slice(-1):"\\"+f;this.options.pedantic&&(f=p?f:"[*+-]");for(var v=new RegExp("^( {0,3}"+f+")((?:[\t ][^\\n]*)?(?:\\n|$))");t&&(d=!1,e=v.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(function(t){return" ".repeat(3*t.length)})),l=t.split("\n",1)[0],this.options.pedantic?(n=2,c=h.trimLeft()):(n=e[2].search(/[^ ]/),c=h.slice(n=4=n||!l.trim())c+="\n"+l.slice(n);else{if(a)break;if(4<=h.search(/[^ ]/))break;if(b.test(h))break;if(x.test(h))break;if(y.test(h))break;c+="\n"+l}a||l.trim()||(a=!0),i+=u+"\n",t=t.substring(u.length+1),h=l.slice(n)}g.loose||(o?g.loose=!0:/\n *\n *$/.test(i)&&(o=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==s[0],c=c.replace(/^\[[ xX]\] +/,"")),g.items.push({type:"list_item",raw:i,task:!!s,checked:r,loose:!1,text:c}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=c.trimRight(),g.raw=g.raw.trimRight();for(var C,k=g.items.length,S=0;S$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]&&t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:e,raw:t[0],href:i,title:s}},i.table=function(t){if(t=this.rules.block.table.exec(t)){var e={type:"table",header:_(t[1]).map((function(t){return{text:t}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];for(var i,s,r,n=e.align.length,a=0;a/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]}},i.link=function(t){if(t=this.rules.inline.link.exec(t)){var e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;var i=E(e.slice(0,-1),"\\");if((e.length-i.length)%2==0)return}else i=function(t,e){if(-1!==t.indexOf(e[1]))for(var i=t.length,s=0,r=0;r$/.test(e)?i.slice(1):i.slice(1,-1):i)&&i.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}},i.reflink=function(t,e){var i;if(i=(i=this.rules.inline.reflink.exec(t))||this.rules.inline.nolink.exec(t))return(t=e[(t=(i[2]||i[1]).replace(/\s+/g," ")).toLowerCase()])?P(i,t,i[0],this.lexer):{type:"text",raw:e=i[0].charAt(0),text:e}},i.emStrong=function(t,e,i){void 0===i&&(i="");var s=this.rules.inline.emStrong.lDelim.exec(t);if(s&&(!s[3]||!i.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDCD0-\uDCEB\uDCF0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/))&&(!s[1]&&!s[2]||""===i||this.rules.inline.punctuation.exec(i))){var r=s[0].length-1,n=r,a=0,o="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(o.lastIndex=0,e=e.slice(-1*t.length+r);null!=(s=o.exec(e));){var h,l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(l)if(h=l.length,s[3]||s[4])n+=h;else if((s[5]||s[6])&&r%3&&!((r+h)%3))a+=h;else if(!(0<(n-=h)))return h=Math.min(h,h+n+a),l=t.slice(0,r+s.index+(s[0].length-l.length)+h),Math.min(r,h)%2?(h=l.slice(1,-1),{type:"em",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}):(h=l.slice(2,-2),{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)})}}},i.codespan=function(t){var e,i,s;if(t=this.rules.inline.code.exec(t))return s=t[2].replace(/\n/g," "),e=/[^ ]/.test(s),i=/^ /.test(s)&&/ $/.test(s),s=d(s=e&&i?s.substring(1,s.length-1):s,!0),{type:"codespan",raw:t[0],text:s}},i.br=function(t){if(t=this.rules.inline.br.exec(t))return{type:"br",raw:t[0]}},i.del=function(t){if(t=this.rules.inline.del.exec(t))return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}},i.autolink=function(t,e){var i;if(t=this.rules.inline.autolink.exec(t))return e="@"===t[2]?"mailto:"+(i=d(this.options.mangle?e(t[1]):t[1])):i=d(t[1]),{type:"link",raw:t[0],text:i,href:e,tokens:[{type:"text",raw:i,text:i}]}},i.url=function(t,e){var i,s,r,n;if(i=this.rules.inline.url.exec(t)){if("@"===i[2])r="mailto:"+(s=d(this.options.mangle?e(i[0]):i[0]));else{for(;n=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0],n!==i[0];);s=d(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}},i.inlineText=function(t,e){if(t=this.rules.inline.text.exec(t))return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):d(t[0]):t[0]:d(this.options.smartypants?e(t[0]):t[0]),{type:"text",raw:t[0],text:e}},e}(),M={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:w,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},D=(M.def=v(M.def).replace("label",M._label).replace("title",M._title).getRegex(),M.bullet=/(?:[*+-]|\d{1,9}[.)])/,M.listItemStart=v(/^( *)(bull) */).replace("bull",M.bullet).getRegex(),M.list=v(M.list).replace(/bull/g,M.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+M.def.source+")").getRegex(),M._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",M._comment=/|$)/,M.html=v(M.html,"i").replace("comment",M._comment).replace("tag",M._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),M.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.blockquote=v(M.blockquote).replace("paragraph",M.paragraph).getRegex(),M.normal=i({},M),M.gfm=i({},M.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),M.gfm.table=v(M.gfm.table).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.gfm.paragraph=v(M._paragraph).replace("hr",M.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",M.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",M._tag).getRegex(),M.pedantic=i({},M.normal,{html:v("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",M._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:w,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(M.normal._paragraph).replace("hr",M.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",M.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:w,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:w,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",D.punctuation=v(D.punctuation).replace(/punctuation/g,D._punctuation).getRegex(),D.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,D.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,D._comment=v(M._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),D.emStrong.lDelim=v(D.emStrong.lDelim).replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimAst=v(D.emStrong.rDelimAst,"g").replace(/punct/g,D._punctuation).getRegex(),D.emStrong.rDelimUnd=v(D.emStrong.rDelimUnd,"g").replace(/punct/g,D._punctuation).getRegex(),D._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,D._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,D._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,D.autolink=v(D.autolink).replace("scheme",D._scheme).replace("email",D._email).getRegex(),D._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,D.tag=v(D.tag).replace("comment",D._comment).replace("attribute",D._attribute).getRegex(),D._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,D._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,D.link=v(D.link).replace("label",D._label).replace("href",D._href).replace("title",D._title).getRegex(),D.reflink=v(D.reflink).replace("label",D._label).replace("ref",M._label).getRegex(),D.nolink=v(D.nolink).replace("ref",M._label).getRegex(),D.reflinkSearch=v(D.reflinkSearch,"g").replace("reflink",D.reflink).replace("nolink",D.nolink).getRegex(),D.normal=i({},D),D.pedantic=i({},D.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",D._label).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D._label).getRegex()}),D.gfm=i({},D.normal,{escape:v(D.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\'+(i?t:d(t,!0))+"\n":"
    "+(i?t:d(t,!0))+"
    \n"},i.blockquote=function(t){return"
    \n"+t+"
    \n"},i.html=function(t,e){return t},i.heading=function(t,e,i,s){return this.options.headerIds?"'+t+"\n":""+t+"\n"},i.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},i.list=function(t,e,i){var s=e?"ol":"ul";return"<"+s+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"},i.listitem=function(t){return"
  • "+t+"
  • \n"},i.checkbox=function(t){return" "},i.paragraph=function(t){return"

    "+t+"

    \n"},i.table=function(t,e){return"\n\n"+t+"\n"+(e=e&&""+e+"")+"
    \n"},i.tablerow=function(t){return"\n"+t+"\n"},i.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"\n"},i.strong=function(t){return""+t+""},i.em=function(t){return""+t+""},i.codespan=function(t){return""+t+""},i.br=function(){return this.options.xhtml?"
    ":"
    "},i.del=function(t){return""+t+""},i.link=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t='"+i+"")},i.image=function(t,e,i){return null===(t=b(this.options.sanitize,this.options.baseUrl,t))?i:(t=''+i+'":">"))},i.text=function(t){return t},e}(),B=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),I=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,s=0;if(this.seen.hasOwnProperty(i))for(s=this.seen[t];i=t+"-"+ ++s,this.seen.hasOwnProperty(i););return e||(this.seen[t]=s,this.seen[i]=0),i},e.slug=function(t,e){return void 0===e&&(e={}),t=this.serialize(t),this.getNextSafeSlug(t,e.dryrun)},t}(),j=function(){function e(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new B,this.slugger=new I}e.parse=function(t,i){return new e(i).parse(t)},e.parseInline=function(t,i){return new e(i).parseInline(t)};var i=e.prototype;return i.parse=function(t,e){void 0===e&&(e=!0);for(var i,s,r,n,a,o,h,l,u,c,d,p,f,v,m,y,b="",x=t.length,C=0;C",o?Promise.resolve(e):h?void h(null,e):e;if(o)return Promise.reject(t);if(!h)throw t;h(t)});if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(u=n,(l=r)&&!l.silent&&(u&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(l.sanitize||l.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),!l.highlight&&"language-"===l.langPrefix||console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),l.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),l.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),l.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),l.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),l.headerIds||l.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."),r.hooks&&(r.hooks.options=r),n){var p,g=r.highlight;try{r.hooks&&(s=r.hooks.preprocess(s)),p=t(s,r)}catch(s){return c(s)}var f,v=function(t){var i;if(!t)try{r.walkTokens&&G.walkTokens(p,r.walkTokens),i=e(p,r),r.hooks&&(i=r.hooks.postprocess(i))}catch(i){t=i}return r.highlight=g,t?c(t):n(null,i)};return!g||g.length<3?v():(delete r.highlight,p.length?(f=0,G.walkTokens(p,(function(t){"code"===t.type&&(f++,setTimeout((function(){g(t.text,t.lang,(function(e,i){if(e)return v(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0==--f&&v()}))}),0))})),void(0===f&&v())):v())}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then((function(e){return t(e,r)})).then((function(t){return r.walkTokens?Promise.all(G.walkTokens(t,r.walkTokens)).then((function(){return t})):t})).then((function(t){return e(t,r)})).then((function(t){return r.hooks?r.hooks.postprocess(t):t})).catch(c);try{r.hooks&&(s=r.hooks.preprocess(s));var m=t(s,r),y=(r.walkTokens&&G.walkTokens(m,r.walkTokens),e(m,r));return r.hooks?r.hooks.postprocess(y):y}catch(s){return c(s)}}}function G(t,e,i){return N(R.lex,j.parse)(t,e,i)}z.passThroughHooks=new Set(["preprocess","postprocess"]),G.options=G.setOptions=function(e){return G.defaults=i({},G.defaults,e),e=G.defaults,t.defaults=e,G},G.getDefaults=n,G.defaults=t.defaults,G.use=function(){for(var t=G.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,s=new Array(e),r=0;r0?(n=new z,t.paragraphs.length>0&&n.addChild(sr(t,e)),rr(t.children,e,n)):n=sr(t,e),n;switch(u.type){case"if":var c=new j({title:"[if]"}),d=nr(u.match[1],t);try{f=new V({expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({expression:"false"})}t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),c.addChild(f);var p=new F;return c.addChild(p),c;case"else":case"else if":var g=u.type;d="else"===g?"true":nr(u.match[1],t);try{f=new V({title:`[${g}]`,expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:`[${g}]`,expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),f;case"while":var f,v=new $({title:"[while]",returnSuccess:!0});d=nr(u.match[1],t);try{f=new V({title:"[while-IF]",expression:d})}catch(e){console.error(`[EventSheet] Parse expression '${d}' at Heading ${t.title} failed, replace expression by 'false'`),console.error(e),f=new V({title:"[while-IF]",expression:"false"})}return t.children.length>0?f.addChild(rr(t.children,e)):f.addChild(sr(t,e)),v.addChild(f),v;case"repeat":var m=(l=u.match[1]).startsWith("#(")&&l.endsWith(")")?l.substring(2,l.length-1):l,y=new W({title:"[repeat]",maxLoop:m});return t.children.length>0?y.addChild(rr(t.children,e)):y.addChild(sr(t,e)),y;default:console.error(`Missing ${u.type}'s handler`)}},nr=function(t,e){var i=t.trim();return""===i&&(i=Js(e)),i},ar=function(t,e,{groupName:i,lineBreak:s="\\",commentLineStart:r="//",parallel:n=!1,active:a=!0,once:o=!1}={}){var h=function(t){for(var e=Gs.lexer(t),i=null,s=[],r=0;r0?v.addChild(rr(c[0],p)):v.addChild(new F),f.addChild(v),g};class or extends Is{boot(){super.boot(),this.scene&&this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(t){if(!this.isShutdown)return this.scene&&this.scene.sys.events.off("shutdown",this.destroy,this),super.shutdown(t),this}addEventSheet(t,e,i){"string"!=typeof e&&(i=e,e=void 0),void 0===e&&(e=this.defaultTreeGroupName),void 0===i&&(i={});var{lineBreak:s="\\",commentLineStart:r="//",parallel:n=this.parallel,groupName:e=e}=i,a=ar(this,t,{groupName:e,lineBreak:s,commentLineStart:r,parallel:n});return this.addTree(a,a.groupName),this}} /* @license Papa Parse v5.4.1 https://github.com/mholt/PapaParse License: MIT */ -!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(C(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!C(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=C(s.step),s.chunk=C(s.chunk),s.complete=C(s.complete),s.error=C(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&C(i.read)&&C(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),X();if(z===f-1)return X(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return X();function Y(t){x.push(t),w=u}function W(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function X(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,Y(S),b&&H()),V()}function $(t){u=t,Y(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Pr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Xr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Xr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Vr(t,e),a=e.x,o=e.y,Hr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Wr=void 0,Xr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,qr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,qr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Ur=void 0,qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Kr=Phaser.Utils.Objects.GetValue;var Jr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Kr(i,"color"),r=Kr(i,"lineWidth"),n=Kr(i,"fillColor"),a=Kr(i,"fillAlpha",1),o=Kr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Un:Hn,this.repeatCounter=0,this}stop(){return this.state=Vn,this}update(t,e){this.state!==Vn&&this.state!==Kn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=qn)):(this.nowTime=this.duration,this.state=Kn):this.nowTime>=0&&(this.state=Un))}get t(){var t;switch(this.state){case Vn:case Hn:case qn:t=0;break;case Un:t=this.nowTime/this.duration;break;case Kn:t=1}return Xn(t,0,1)}set t(t){(t=Xn(t,-1,1))<0?(this.state=Hn,this.nowTime=-this.delay*t):(this.state=Un,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Vn}get isDelay(){return this.state===Hn}get isCountDown(){return this.state===Un}get isRunning(){return this.state===Hn||this.state===Un}get isDone(){return this.state===Kn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Vn=0,Hn=1,Un=2,qn=3,Kn=-1;class Jn extends Gn{constructor(t,e){super(t,e),this.timer=new $n}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Zn=Phaser.Utils.Objects.GetValue,Qn=Phaser.Utils.Objects.GetAdvancedValue,ta=Phaser.Tweens.Builders.GetEaseFunction;class ea extends Jn{resetFromJSON(t){return this.timer.resetFromJSON(Zn(t,"timer")),this.setEnable(Zn(t,"enable",!0)),this.setTarget(Zn(t,"target",this.parent)),this.setDelay(Qn(t,"delay",0)),this.setDuration(Qn(t,"duration",1e3)),this.setEase(Zn(t,"ease","Linear")),this.setRepeat(Zn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ta(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ia=Phaser.Sound.BaseSound;var sa=function(t){return t instanceof ia};const ra=Phaser.Utils.Objects.GetValue,na=Phaser.Utils.Objects.GetAdvancedValue,aa=Phaser.Math.Linear;let oa=class extends ea{constructor(t,e,i){sa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ra(t,"mode",0)),this.setEnable(ra(t,"enable",!0)),this.setVolumeRange(na(t,"volume.start",this.parent.volume),na(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ha[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=aa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ha={stop:1,destroy:2};var la=function(t,e,i,s,r){sa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new oa(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ua=function(t,e,i,s){sa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new oa(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ca=Phaser.Utils.Objects.GetValue;var da={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ca(e,"loop",this.backgroundMusicLoop),mute:ca(e,"mute",this.backgroundMusicMute),volume:ca(e,"volume",this.backgroundMusicVolume),detune:ca(e,"detune",0),rate:ca(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&la(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ua(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const pa=Phaser.Utils.Objects.GetValue;var ga={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:pa(e,"loop",this.backgroundMusicLoop),mute:pa(e,"mute",this.backgroundMusic2Mute),volume:pa(e,"volume",this.backgroundMusic2Volume),detune:pa(e,"detune",0),rate:pa(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&la(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const fa=Phaser.Utils.Array.Remove,va=Phaser.Utils.Objects.GetValue;var ma={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:va(e,"mute",this.soundEffectsMute),volume:va(e,"volume",this.soundEffectsVolume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&fa(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&fa(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&la(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ua(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ua(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&la(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ua(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ua(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Da=Phaser.Utils.Objects.GetValue,Aa=new class extends Ma{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Za(this.delimiterLeft),e=Za(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=io),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=no),this.tagExpression=t,this}setValueExpression(t){return t||(t=no),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==no||this.valueExpression!==no){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Za(this.delimiterLeft),e=Za(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=so(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const no="[^=]+";var ao=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],oo=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},ho=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:oo(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},bo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},xo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},Co={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},ko={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},So=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},wo={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return So(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!So(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},_o={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Wo=Phaser.GameObjects.Zone;let Xo=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const $o="BG",Vo="SPRITE",Ho="TEXTBOX",Uo="TITLE",qo="CHOICE",Ko="NAMEINPUT";var Jo=!1,Zo=function(t){Jo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return th(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return eh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ioh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eoh(t).x,getChildLocalY:t=>oh(t).y};const Sh=Phaser.Math.DegToRad;var wh={updateChildRotation(t){var e=oh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=oh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return oh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return oh(t).rotation=Sh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=oh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>oh(t).rotation},_h={updateChildScale(t){var e=oh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=oh(t),i=e.parent;return e.scaleX=Ch(t.scaleX,i.scaleX),e.scaleY=Ch(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=oh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=oh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>oh(t).scaleX,getChildLocalScaleY:t=>oh(t).scaleY},Eh={updateChildVisible(t){var e=oh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=oh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),oh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),oh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=oh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>oh(t).visible},Th={updateChildAlpha(t){var e=oh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=oh(t),i=e.parent;return e.alpha=Ch(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return oh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=oh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>oh(t).alpha},Ph={updateChildActive(t){var e=oh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return oh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),oh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=oh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>oh(t).active},Oh={updateChildScrollFactor(t){var e=oh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Mh={updateCameraFilter(t){var e=oh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Dh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Ah=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Lh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Rh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Bh=Phaser.Utils.Array;var Ih={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var P=b+k*_+a*k,O=x+S*w+o*S;E.setOrigin(a,o).setPosition(P,O).setScale(f,v).setRotation(m),Ol(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(zl.prototype,Al);const Gl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Yl=Phaser.GameObjects.GetCalcMatrix;const Wl=Phaser.Renderer.Canvas.SetTransform;var Xl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Yl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},iu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const su=Phaser.Geom.Polygon.Earcut;class ru extends Kl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=su(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Zl(t,e,this,i,s,r),this.isStroked&&tu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const au=Phaser.Math.DegToRad;var ou=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Fu(t,"tl",0),this.radiusTR=Fu(t,"tr",0),this.radiusBL=Fu(t,"bl",0),this.radiusBR=Fu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?ou(e,e,e,e,180,270,!1,r,t):ou(0,0,e,e,90,0,!0,r,t):nu(0,0,t);(e=this.radiusTR)>0?this._convexTR?ou(i-e,e,e,e,270,360,!1,r,t):ou(i,0,e,e,180,90,!0,r,t):nu(i,0,t);(e=this.radiusBR)>0?this._convexBR?ou(i-e,s-e,e,e,0,90,!1,r,t):ou(i,s,e,e,270,180,!0,r,t):nu(i,s,t);(e=this.radiusBL)>0?this._convexBL?ou(e,s-e,e,e,90,180,!1,r,t):ou(0,s,e,e,360,270,!0,r,t):nu(0,s,t);return t.push(t[0],t[1]),mu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Kl{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Bu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&tu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(eu(t,this),t.fill()),this.isStroked&&(iu(t,this),t.stroke())}}},ju=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject,Nu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),dc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,uc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class fc extends zl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=gc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},zc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Nc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(zc(t));t=this.sections.join("\n");this.lines=jc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign($c,Nc,Yc,Xc);const Vc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Hc extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ic(this.parent),this.pageStartIndexes=[],this.lines=jc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Vc(t,"maxLines",void 0)),this.setPageBreak(Vc(t,"pageBreak","\f\n")),this.setText(Vc(t,"text","")),this.startLineIndex=Vc(t,"start",-1),this.endLineIndex=Vc(t,"end",void 0);var e=Vc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Ic(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Hc.prototype,$c);var Uc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(zc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},qc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},Kc=function(t,e){for(var i=void 0,s=0;s0)l=Jc(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=Jc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},Qc={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=qc(this.parent,t);n=Kc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Zc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(Qc,Uc);const td=Phaser.Utils.Objects.GetFastValue,ed=Phaser.Utils.Objects.GetValue;class id extends Bn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ed(t,"wrap",!1)),this.setTypeMode(ed(t,"typeMode",0)),this.setTypingSpeed(ed(t,"speed",333)),this.setTextCallback=td(t,"setTextCallback",null),this.setTextCallbackScope=td(t,"setTextCallbackScope",null),this.setTypingContent(td(t,"text","")),this.typingIndex=td(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=td(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=sd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=zc(t);this.textWrapEnable&&(e=function(t,e){switch(Ic(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=qc(this.parent,this.text).length,this}onTyping(){var t=Zc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Wc(this.parent,t):this.parent.setText(t)}}const sd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(id.prototype,Qc);const rd=Phaser.Utils.Objects.GetValue;const nd={page:0,line:1};var ad=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const od=Phaser.Display.Align;var hd={center:od.CENTER,left:od.LEFT_CENTER,right:od.RIGHT_CENTER,top:od.TOP_CENTER,bottom:od.BOTTOM_CENTER,"left-top":od.TOP_LEFT,"top-left":od.TOP_LEFT,"left-center":od.LEFT_CENTER,"center-left":od.LEFT_CENTER,"left-bottom":od.BOTTOM_LEFT,"bottom-left":od.BOTTOM_LEFT,"center-top":od.TOP_CENTER,"top-center":od.TOP_CENTER,"center-center":od.CENTER,"center-bottom":od.BOTTOM_CENTER,"bottom-center":od.BOTTOM_CENTER,"right-top":od.TOP_RIGHT,"top-right":od.TOP_RIGHT,"right-center":od.RIGHT_CENTER,"center-right":od.RIGHT_CENTER,"right-bottom":od.BOTTOM_RIGHT,"bottom-right":od.BOTTOM_RIGHT},ld=function(){},ud=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ld,events:{once:ld}}},0,0,1,1);ud.setOrigin(0);var cd=0,dd=1,pd=2,gd=4,fd=6,vd=8,md=10,yd=12,bd=function(t){var e=jr(t);return t.y+e-e*t.originY},xd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},Cd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},kd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Sd=function(t){var e=Ir(t);return t.x-e*t.originX},wd=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},_d=function(t){var e=Ir(t);return t.x+e-e*t.originX},Ed=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Td=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Od=function(t){var e=jr(t);return t.y-e*t.originY},Md=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Dd=[];Dd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Cd(t,bd(e)+s),t},Dd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Cd(t,bd(e)+s),t},Dd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Cd(t,bd(e)+s),t},Dd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){kd(t,e),Td(t,i)}(t,xd(e)+i,Pd(e)+s),t},Dd[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Td(t,Pd(e)+s),t},Dd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Td(t,Pd(e)+s),t},Dd[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Md(t,Od(e)-s),t},Dd[cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Md(t,Od(e)-s),t},Dd[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Md(t,Od(e)-s),t};var Ad=function(t,e,i,s,r){return Dd[i](t,e,s,r)},Ld=function(t,e,i,s,r,n){ud.setPosition(e,i).setSize(s,r),Ad(t,ud,n)};const Rd=Phaser.Utils.Objects.GetValue,Fd=Phaser.GameObjects.Group;var Bd=function(t,e,i){return t.add.text(0,0,"")},Id=void 0;const jd=il.prototype.add;var zd=function(t){return jd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Nd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=xl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Gd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Gd(i)):i=null);else for(i=Gd(t);i&&i.name!==e;)i=Gd(i);return i},Yd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Gd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Gd(t);e;)t=e,e=Gd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Gd(e);i;){if(i===t)return!0;i=Gd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const Wd=Phaser.Utils.Array.Remove,Xd=il.prototype.remove,$d=Yd.getParentSizer;var Vd=function(t,e){for(var i=$d(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=$d(i);return this.isBackground(t)&&Wd(this.backgroundChildren,t),Xd.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Hd=Phaser.Utils.Array.Remove,Ud=Yd.getParentSizer;var qd={removeFromParentSizer(){var t=Ud(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Hd(this.backgroundChildren,t),Vd.call(this,t,e)),this},removeAllBackgrounds(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}},Kd=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};const Jd=/(\S+)\[(\d+)\]/i;const Zd=Phaser.Utils.Objects.GetValue;var Qd=function(t,e){return void 0===e?t:t[e]},tp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Zd(e,"left",0),t.right=Zd(e,"right",0),t.top=Zd(e,"top",0),t.bottom=Zd(e,"bottom",0)),t},ep={getInnerPadding(t){return Qd(this.space,t)},setInnerPadding(t,e){return tp(this.space,t,e),this},getOuterPadding(t){return Qd(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return tp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Qd(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),tp(this.getSizerConfig(t).padding,e,i),this}},ip=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},sp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},rp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},np=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ap=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},op=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},hp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},lp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var vg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Dn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},mg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ld),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ld),this.transitOutCallback=t,this}},yg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},bg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},xg={};Object.assign(xg,vg,mg,yg,bg);const Cg=Phaser.Utils.Objects.GetValue;class kg extends Bn{constructor(t,e){super(t,e),this.setTransitInTime(Cg(e,"duration.in",200)),this.setTransitOutTime(Cg(e,"duration.out",200)),this.setTransitInCallback(Cg(e,"transitIn")),this.setTransitOutCallback(Cg(e,"transitOut")),this.oneShotMode=Cg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new fg(this,{eventEmitter:!1,initState:Cg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(kg.prototype,xg);const Sg=Phaser.GameObjects.Rectangle;class wg extends Sg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Yo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const _g=Phaser.Utils.Objects.GetValue;class Eg extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(_g(t,"hitAreaMode",0)),this.setEnable(_g(t,"enable",!0)),this.setStopMode(_g(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Tg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Tg={default:0,fullWindow:1};const Pg=Phaser.Utils.Objects.GetValue;class Og extends wg{constructor(t,e){super(t,Pg(e,"color",0),Pg(e,"alpha",.8)),this.touchEventStop=new Eg(this,{hitAreaMode:1})}}var Mg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wp(t,e)},scaleDown(t,e){_p(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e)},fadeOut(t,e){jp(t,e,!1)}},Dg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e,t.alpha)},Ag=function(t,e){jp(t,e,!1)},Lg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Rg=Phaser.Utils.Objects.GetValue;let Fg=class extends kg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Bg.popUp),null==e.transitOut&&(e.transitOut=Bg.scaleDown),e.destroy=Rg(e,"destroy",!0),super(t,e);var i=Rg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Og(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Rg(i,"transitIn",Dg)),this.setCoverTransitOutCallback(Rg(i,"transitOut",Ag)));var s=Rg(e,"touchOutsideClose",!1),r=Rg(e,"duration.hold",-1),n=Rg(e,"timeOutClose",r>=0),a=Rg(e,"anyTouchClose",!1);Rg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Rg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.popUp:t=Mg.popUp;break;case Bg.fadeIn:t=Mg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.scaleDown:t=Mg.scaleDown;break;case Bg.fadeOut:t=Mg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Bg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ig=function(t){return t&&"function"==typeof t},jg={modal(t,e){return Ig(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Fg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},zg=function(t,e,i,s,r){Ig(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ng={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),fo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return zg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return zg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return zg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return zg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return zg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return zg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return zg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return zg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return zg.call(this,"shutdown",t,e,i,s),this}},Gg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Yg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Yg={},Wg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lg(t,e.x,e.y,i,s):!!(r=Gg(e,n,!0))&&Lg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const ef={press:0,pointerdown:0,release:1,pointerup:1};var sf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new tf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},rf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!nf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return af.length=0,!0;return af.length=0,!1},af=[];const of=Phaser.Utils.Objects.GetValue;class hf extends Bn{constructor(t,e){super(t,e),this._enable=void 0;var i=of(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(of(t,"enable",!0)),this.setMode(of(t,"mode",1)),this.setClickInterval(of(t,"clickInterval",100)),this.setDragThreshold(of(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=lf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?rf:Wg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new hf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class cf extends gg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const df=Phaser.Utils.Objects.GetValue;class pf extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new cf,this.parent.setInteractive(df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(df(t,"enable",!0)),this.setCooldown(df(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var gf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Wg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new pf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new pf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ff={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},vf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Af,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Lf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Af,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Wg(t,s,e,i)}}const Af=0,Lf=1,Rf="IDLE",Ff=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Distance.Between;class If extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=jf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ff(t,"time",250)),this.setTapInterval(Ff(t,"tapInterval",200)),this.setDragThreshold(Ff(t,"threshold",9)),this.setTapOffset(Ff(t,"tapOffset",10));var e=Ff(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ff(t,"maxTaps",void 0)),this.setMinTaps(Ff(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case jf:this.state=zf;break;case zf:var t=this.lastPointer;Bf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Nf,this.state=zf);break;case Nf:this.state=zf}}onDragEnd(){this.state===zf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Nf))}onDrag(){this.state!==jf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===zf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=jf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Nf:this.state=jf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Nf&&(this.state=jf)}get isTapped(){return this.state===Nf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const jf="IDLE",zf="BEGIN",Nf="RECOGNIZED",Gf=Phaser.Utils.Objects.GetValue;class Yf extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Gf(t,"threshold",9)),this.setHoldTime(Gf(t,"time",251)),this}onDragStart(){this.state=Xf,0===this.holdTime&&(this.state=$f)}onDragEnd(){this.state=Wf}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Xf&&t-this.pointer.downTime>=this.holdTime&&(this.state=$f))}get isPressed(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Wf="IDLE",Xf="BEGIN",$f="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Vf=function(t){return Rn(t).loop.delta};const Hf=Phaser.Math.Distance.Between,Uf=Phaser.Math.Angle.Between;var qf={getDt:function(){return Vf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uf(e.x,e.y,t.x,t.y)}},Kf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jf={};const Zf=Phaser.Utils.Objects.GetValue,Qf=Phaser.Math.RadToDeg;class tv extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=ev},eventEmitter:!1};this.setRecongizedStateObject(new gg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zf(t,"threshold",10)),this.setVelocityThreshold(Zf(t,"velocityThreshold",1e3)),this.setDirectionMode(Zf(t,"dir","8dir")),this}onDragStart(){this.state=iv}onDragEnd(){this.state=ev}onDrag(){this.state===iv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=sv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sv&&(this.state=ev)}get isSwiped(){return this.state===sv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Kf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jf),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Qf(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(tv.prototype,qf);const ev="IDLE",iv="BEGIN",sv="RECOGNIZED",rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Array.SpliceOne,av=Phaser.Math.Distance.Between,ov=Phaser.Math.Angle.Between;class hv{constructor(t,e){var i=Dn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(rv(e,"inputConfig",void 0)),this.setEventEmitter(rv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(rv(t,"enable",!0)),this.bounds=rv(t,"bounds",void 0),this.tracerState=uv,this.pointers.length=0,oo(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,oo(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case uv:this.tracerState=cv,this.onDrag1Start();break;case cv:this.tracerState=dv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],nv(this.pointers,e),this.tracerState){case cv:this.tracerState=uv,this.onDrag1End();break;case dv:this.tracerState=cv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case cv:this.onDrag1();break;case dv:this.onDrag2()}}}dragCancel(){return this.tracerState===dv&&this.onDrag2End(),this.pointers.length=0,oo(this.movedState),this.tracerState=uv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return av(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return ov(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;lv.x=e.x-i.x,lv.y=e.y-i.y}else lv.x=0,lv.y=0;return lv}get centerX(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==dv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==dv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=pv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Wg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Wg(t,s,e,i)}}Object.assign(hv.prototype,hr);var lv={};const uv=0,cv=1,dv=2,pv="IDLE";Phaser.Utils.Objects.GetValue;const gv=Phaser.Math.RotateAround;var fv=function(t,e,i,s){return gv(t,e,i,s),t.rotation+=s,t},vv={};const mv=Phaser.Utils.Objects.GetValue,yv=Phaser.Math.Angle.WrapDegrees,bv=Phaser.Math.Angle.ShortestBetween,xv=Phaser.Math.RadToDeg,Cv=Phaser.Math.DegToRad;var kv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=vv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.state=_v}break;case _v:t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_v}get rotation(){return Cv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,kv);const Sv="IDLE",wv="BEGIN",_v="RECOGNIZED",Ev=Phaser.Utils.Objects.GetValue;var Tv=function(t){var e=Ev(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new If(this,e),this._tap.on("tap",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Pv=Phaser.Utils.Objects.GetValue;var Ov=function(t){var e=Pv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Yf(this,e),this._press.on("pressstart",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new tv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";mf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Av=Phaser.Utils.Objects.GetValue;var Lv=function(t,e){return t.setInteractive(),Av(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Av(e,"targets",[t]),targetMode:Av(e,"targetMode","parent"),eventEmitter:Av(e,"eventEmitter",t),eventNamePrefix:Av(e,"inputEventPrefix","child.")},bf.call(t,e),kf.call(t,e),_f.call(t,e),Of.call(t,e),Tv.call(t,e),Ov.call(t,e),Dv.call(t,e),t},Rv={getSizerConfig:function(t){return void 0===t&&(t=this),ad(t)},getChildPrevState:function(t){var e=ad(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=an(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Rd(e,"color"),s=Rd(e,"lineWidth");var h=Rd(e,"name",!1);h&&(r=Rd(h,"createTextCallback",Bd),n=Rd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Rd(h,"align","left-top"))&&(a=hd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Fd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var u,c,d=this.getAllShownChildren([this]),p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Wv=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Utils.Objects.GetValue,$v=Phaser.Display.Align.CENTER,Vv={min:0,full:-1};var Hv=function(t,e,i,s,r,n,a,o,h,l){zd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=Vv[e];else if(Wv(e)){var d;e=Xv(d=e,"proportion",void 0),i=Xv(d,"align",$v),s=Xv(d,"padding",0),r=Xv(d,"expand",!1),n=Xv(d,"key",void 0),a=Xv(d,"index",void 0),t.isRexSizer||(o=Xv(d,"minWidth",void 0),h=Xv(d,"minHeight",void 0)),l=Xv(d,"fitRatio",0)}return"string"==typeof i&&(i=hd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=$v),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=xl(s),d.expand=r,d.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Uv={add:Hv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Hv.call(this,new Gv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Wv(i)&&(i.index=t),Hv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Yv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const qv=il.prototype.clear;var Kv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kv.call(this,t),this}},Qv={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=hd[e]),this.getSizerConfig(t).align=e,this}},tm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},em={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},im={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},sm={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(dp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,lp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||sp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&zv.call(this,t,void 0),rp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ap.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&zv.call(this,void 0,t),op.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(sm,Uv,Zv,Qv,tm,em,im);var rm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},nm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},am=function(t){return"string"==typeof t&&(t=nm[t]),t};const om=Phaser.Utils.Objects.IsPlainObject,hm=Phaser.Utils.Objects.GetValue;class lm extends Bv{constructor(t,e,i,s,r,n,a){om(e)?(e=hm(a=e,"x",0),i=hm(a,"y",0),s=hm(a,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(s)?(s=hm(a=s,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(n)&&(n=hm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(hm(a,"space.item",0)),this.setStartChildIndex(hm(a,"startChildIndex",0)),this.setRTL(hm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=am(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=rm.call(this)),this._childrenProportion}}Object.assign(lm.prototype,sm);var um=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},cm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},dm={appendText:cm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class pm extends lm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(um(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(um(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&um(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&um(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(pm.prototype,dm);var gm=function(t,e,i,s){var r=new Sl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const fm=Phaser.Utils.Objects.GetValue;const vm=Phaser.Utils.Objects.GetValue;var mm=/^[\x00-\x7F]+$/,ym=function(t){return mm.test(t)},bm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Cm=0,km=1,Sm=2,wm=0,_m=1,Em=2,Tm=/(?:\r\n|\r|\n)/;const Pm={none:wm,word:_m,char:Em,character:Em,mix:3};var Om=function(t,e){switch(Ic(t)){case 0:switch("string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=bm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e}};const Mm=Phaser.Renderer.WebGL.Utils;var Dm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Mm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Am=Phaser.Display.Color;var Lm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Am);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Rm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Fm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Rm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Zo();const Bm=Phaser.Display.Canvas.CanvasPool,Im=Phaser.GameObjects.GameObject,jm=Phaser.Utils.String.UUID;class zm extends Im{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Bm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=jm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Bm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Nm=Phaser.GameObjects.Components;Phaser.Class.mixin(zm,[Nm.Alpha,Nm.BlendMode,Nm.Crop,Nm.Depth,Nm.Flip,Nm.GetBounds,Nm.Mask,Nm.Origin,Nm.Pipeline,Nm.PostPipeline,Nm.ScrollFactor,Nm.Tint,Nm.Transform,Nm.Visible,Dm,Lm,Fm]);let Gm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Gm.prototype,ql);var Ym={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Wm=Phaser.Math.RotateAround;var Xm;const $m=Phaser.Geom.Rectangle;var Vm,Hm=function(t){void 0===Vm&&(Vm=new $m);var e=t.drawTLX,i=t.drawTLY;return Vm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Vm};const Um=Phaser.Math.RotateAround;var qm,Km=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===qm&&(qm={}),s=qm),s.x=e,s.y=i,0!==t.rotation&&Um(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Jm=Phaser.GameObjects.Components.TransformMatrix;var Zm,Qm,ty={},ey=function(t,e,i,s,r){var n=Km(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ty);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Zm&&(Zm=new Jm,Qm=new Jm),t.parentContainer?t.getWorldTransformMatrix(Zm,Qm):Zm.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Zm.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},iy=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ey(t,e,n,a,r)},sy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Xm&&(Xm={}),s=Xm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wm(s,0,0,-i.rotation),s}(t,e,this,!0);return Hm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return iy(this.parent,this,t,e,i)}};Object.assign(sy,Ym);const ry=Phaser.Math.DegToRad,ny=Phaser.Math.RadToDeg,ay=Phaser.Utils.Objects.GetValue;class oy extends Gm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ny(this._rotation)}set angle(t){this.rotation=ry(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ay(t,"width",void 0),i=ay(t,"height",void 0),s=ay(t,"scaleX",void 0),r=ay(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oy.prototype,sy);const hy=Phaser.Utils.String.Pad;var ly=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},uy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const cy=Phaser.Utils.Objects.GetValue;let dy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=cy(t,"x",0),i=cy(t,"y",0));var s=this.cornerRadius;s.tl=py(cy(t,"tl",void 0),e,i),s.tr=py(cy(t,"tr",void 0),e,i),s.bl=py(cy(t,"bl",void 0),e,i),s.br=py(cy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gy(this.cornerRadius.br,t)}};var py=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),fy(t),t},gy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=cy(e,"x",0),t.y=cy(e,"y",0)),fy(t)},fy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vy=Phaser.Math.DegToRad;var my=function(t){return!t.hasOwnProperty("convex")||t.convex},yy=function(t){return t.x>0&&t.y>0},by=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,l,h,l,180,270,!1,a):by(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,l,h,l,270,360,!1,a):by(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,r-l,h,l,0,90,!1,a):by(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,r-l,h,l,90,180,!1,a):by(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Cy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),xy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const ky=Phaser.Utils.Objects.GetValue;class Sy extends oy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ky(e,"color",null),ky(e,"color2",null),ky(e,"horizontalGradient",!0)),this.setStroke(ky(e,"stroke",null),ky(e,"strokeThickness",2)),this.setCornerRadius(ky(e,"cornerRadius",0),ky(e,"cornerIteration",null))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ly(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,uy("color2",t,this),uy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Cy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wy=Phaser.Utils.Objects.GetValue;class _y extends oy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wy(e,"color",null),wy(e,"color2",null),wy(e,"horizontalGradient",!0)),this.setStroke(wy(e,"stroke",null),wy(e,"strokeThickness",2))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ly(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,wy(t,"color2",null),wy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ey=Phaser.Utils.Objects.GetValue;let Ty=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ey(t,"bold",!1)),this.setItalic(Ey(t,"italic",!1)),this.setFontSize(Ey(t,"fontSize","16px")),this.setFontFamily(Ey(t,"fontFamily","Courier")),this.setColor(Ey(t,"color","#fff")),this.setStrokeStyle(Ey(t,"stroke",null),Ey(t,"strokeThickness",0)),this.setShadow(Ey(t,"shadowColor",null),Ey(t,"shadowOffsetX",0),Ey(t,"shadowOffsetY",0),Ey(t,"shadowBlur",0)),this.setOffset(Ey(t,"offsetX",0),Ey(t,"offsetY",0)),this.setSpace(Ey(t,"leftSpace",0),Ey(t,"rightSpace",0)),this.setAlign(Ey(t,"align",void 0)),this.setBackgroundColor(Ey(t,"backgroundColor",null)),this.setBackgroundHeight(Ey(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ey(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(uy("stroke",t,this),uy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uy("shadowOffsetX",t,this),uy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ly(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ly(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ly(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ly(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Py=Phaser.Utils.Array.Remove;const Oy=Phaser.Utils.Array.Remove;const My="text",Dy="image",Ay="drawer",Ly="space",Ry="command";var Fy=function(t){return t.type===My&&"\n"===t.text},By=function(t){return t.type===My&&"\f"===t.text},Iy=function(t){return t.type===My};class jy extends oy{constructor(t,e,i){super(t,My),this.updateTextFlag=!1,this.style=new Ty(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var zy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ny=Phaser.Display.Canvas.CanvasPool;var Gy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Ny.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Ny.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Yy extends oy{constructor(t,e,i){super(t,Dy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Gy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Wy extends oy{constructor(t,e,i,s){super(t,Ay),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Xy extends oy{constructor(t,e){super(t,Ly),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class $y extends Gm{constructor(t,e,i,s,r){super(t,Ry),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Vy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Hy={none:0,word:1,char:2,character:2,mix:3};var Uy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=Zy.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=Zy.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=tb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=tb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=tb(t,"wrapMode");void 0===c&&(c=tb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Hy[c]);var d=tb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=tb(t,"letterSpacing",0),g=tb(t,"hAlign",0),f=tb(t,"vAlign",0),v=tb(t,"justifyPercentage",.25),m=Vy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(O.push({children:M,width:D}),A=Math.max(A,D)),m.start+=P.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=O.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=sb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=sb(t,"maxLines",0);var o=0===i,h=sb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=sb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=sb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=sb(t,"letterSpacing",0),p=sb(t,"rtl",!0),g=sb(t,"hAlign",p?2:0),f=sb(t,"vAlign",0),v=Vy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(P.push({children:O,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=P.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return tp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Qd(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Py(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Oy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(My);return null===i?i=new jy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),iy(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Ib(t,r,e,i,n),o=0;o<=Rb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ib(t,r,e,i,n)}return o===Rb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),jb(t,e,i),t},Bb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ib=function(t,e,i,s,r){var n,a=Bb(t,e,r),o=Bb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},jb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zb=Phaser.Utils.Objects.GetValue;var Nb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zb(e,"minWidth",0),s=zb(e,"minHeight",0),r=zb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Fb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Fb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Gb=Phaser.Utils.Objects.GetValue,Yb=[function(t){var e=this.scene,i=fm(t,"orientation",0);this.setOrientation(i);var s=fm(t,"icon",void 0),r=fm(t,"iconMask",void 0),n=fm(t,"innerBackground",void 0),a=fm(t,"title",void 0),o=fm(t,"separator",void 0),h=fm(t,"text",void 0),l=fm(t,"action",void 0),u=fm(t,"actionMask",void 0);if(s){var c=fm(t,"align.icon","center");m=0===this.orientation?{right:fm(t,"space.icon",0),top:fm(t,"space.iconTop",0),bottom:fm(t,"space.iconBottom",0),left:fm(t,"space.iconLeft",0)}:{bottom:fm(t,"space.icon",0),left:fm(t,"space.iconLeft",0),right:fm(t,"space.iconRight",0),top:fm(t,"space.iconTop",0)};var d=fm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=gm.call(this,s,s,1)),!d){var p=fm(t,"iconSize",void 0);this.setIconSize(fm(t,"iconWidth",p),fm(t,"iconHeight",p))}}var g=new lm(e,{orientation:1});n&&g.addBackground(n);var f=fm(t,"space.separator",0);if(a){c=fm(t,"align.title","left");var v=fm(t,"expandTitleWidth",!1);y=fm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?fm(t,"space.title",f):0,left:fm(t,"space.titleLeft",0),right:fm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:fm(t,"space.separatorLeft",0),right:fm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=fm(t,"align.text","left");var y,b,x=fm(t,"expandTextWidth",!1);y=fm(t,"expandTextHeight",!1)?1:0,b=x,m={left:fm(t,"space.textLeft",0),right:fm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:fm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=fm(t,"align.action","center");m=0===this.orientation?{top:fm(t,"space.actionTop",0),bottom:fm(t,"space.actionBottom",0),right:fm(t,"space.actionRight",0)}:{left:fm(t,"space.actionLeft",0),right:fm(t,"space.actionRight",0),bottom:fm(t,"space.actionBottom",0)};d=fm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=gm.call(this,l,l,1)),!d){var C=fm(t,"actionSize");this.setActionSize(fm(t,"actionWidth",C),fm(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=vm(t,"title",void 0),s=vm(t,"separator",void 0),r=vm(t,"innerBackground",void 0),n=vm(t,"icon",void 0),a=vm(t,"iconMask",void 0),o=vm(t,"text",void 0),h=vm(t,"action",void 0),l=vm(t,"actionMask",void 0);if(i){var u=vm(t,"align.title","left"),c=vm(t,"expandTitleWidth",!1);y=vm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:vm(t,"space.title",0),left:vm(t,"space.titleLeft",0),right:vm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=vm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:vm(t,"space.separatorLeft",0),right:vm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=vm(t,"orientation",0),f=new lm(e,{orientation:g,rtl:vm(t,"rtl",!1),space:{left:vm(t,"space.innerLeft",0),right:vm(t,"space.innerRight",0),top:vm(t,"space.innerTop",0),bottom:vm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=vm(t,"align.icon","center");p=0===f.orientation?{right:vm(t,"space.icon",0),top:vm(t,"space.iconTop",0),bottom:vm(t,"space.iconBottom",0),left:vm(t,"space.iconLeft",0)}:{bottom:vm(t,"space.icon",0),left:vm(t,"space.iconLeft",0),right:vm(t,"space.iconRight",0),top:vm(t,"space.iconTop",0)};var v=vm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=gm.call(this,n,n,1)),!v){var m=vm(t,"iconSize",void 0);this.setIconSize(vm(t,"iconWidth",m),vm(t,"iconHeight",m))}}if(o){u=vm(t,"align.text","left");var y,b,x=vm(t,"space.text",0),C=vm(t,"expandTextWidth",!1),k=vm(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=vm(t,"align.action","center");p=0===f.orientation?{top:vm(t,"space.actionTop",0),bottom:vm(t,"space.actionBottom",0),right:vm(t,"space.actionRight",0)}:{left:vm(t,"space.actionLeft",0),right:vm(t,"space.actionRight",0),bottom:vm(t,"space.actionBottom",0)};v=vm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=gm.call(this,h,h,1)),!v){var S=vm(t,"actionSize");this.setActionSize(vm(t,"actionWidth",S),vm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Wb extends pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Gb(e,"background",void 0);i&&this.addBackground(i);var s=Gb(e,"title",void 0),r=Gb(e,"text",void 0);if(s){var n=Gb(e,"wrapTitle",!1),a=Gb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Om(s,n),e.expandTitleWidth=!0,Lb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(s,{fitHeight:!0}))}if(r){var o=Gb(e,"wrapText",!1),h=Gb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Om(r,o),e.expandTextWidth=!0,Lb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(r,{fitHeight:!0}))}var l=Gb(e,"layoutMode",0);(Yb[l]||Yb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Xb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=rd(i,"expandTextWidth",!1),n=rd(i,"expandTextHeight",!1);if(r||n){var a=Ic(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(rd(i,"typingMode","page")),this.page=new Hc(s,rd(i,"page",void 0)),this.typing=new id(s,rd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=nd[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Wb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const $b=Phaser.GameObjects.GetCalcMatrix;const Vb=Phaser.Renderer.Canvas.SetTransform;var Hb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$b(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Zl(r,a,e,l,o,h),e.isStroked&&tu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Vb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(qb.prototype,Hb);var Kb=function(t){return t.x>0&&t.y>0};const Jb=Phaser.Utils.Objects.IsPlainObject,Zb=Phaser.Utils.Objects.GetValue,Qb=Phaser.Geom.Polygon.Earcut;class tx extends qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(Jb(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new dy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=Zb(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(Zb(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,Kb(i))if(i.convex){var o=i.x,h=i.y;ou(o,h,i.x,i.y,180,270,!1,a,e)}else{ou(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else nu(0,0,e);if(i=n.tr,Kb(i))if(i.convex){o=s-i.x,h=i.y;ou(o,h,i.x,i.y,270,360,!1,a,e)}else{ou(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else nu(s,0,e);if(i=n.br,Kb(i))if(i.convex){o=s-i.x,h=r-i.y;ou(o,h,i.x,i.y,0,90,!1,a,e)}else{ou(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else nu(s,r,e);if(i=n.bl,Kb(i))if(i.convex){o=i.x,h=r-i.y;ou(o,h,i.x,i.y,90,180,!1,a,e)}else{ou(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else nu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Qb(e),this}setShapeType(t){return"string"==typeof t&&(t=ex[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const ex={rectangle:0,circle:1};var ix=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},sx=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dx=Phaser.Utils.Objects.GetValue,px=Phaser.Utils.Objects.IsPlainObject;class gx extends(sc(Hl)){constructor(t,e,i,s,r,n,a,o){px(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):px(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):px(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(dx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dx(o,"trackStrokeThickness",2),dx(o,"trackStrokeColor",void 0)),this.setSkewX(dx(o,"skewX",0)),this.setRTL(dx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var fx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&cx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),cx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&cx(o,0,0,e,i,t)}};Object.assign(gx.prototype,fx);class vx extends gx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=mx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const mx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(vx.prototype,hx);let yx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const bx=Phaser.GameObjects.NineSlice,xx=Phaser.Utils.Objects.GetValue;class Cx extends bx{constructor(t,e){void 0===e&&(e={}),super(t,xx(e,"x",0),xx(e,"y",0),xx(e,"key",null),xx(e,"frame",null),xx(e,"width",0),xx(e,"height",0),xx(e,"leftWidth",0),xx(e,"rightWidth",0),xx(e,"topHeight",0),xx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=xx(e,"effects",!0);i&&Pr(this,i),this.style=new yx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cx.prototype,hx);let kx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Sx=Phaser.GameObjects.Image,wx=Phaser.Utils.Objects.GetValue;class _x extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",""),wx(e,"frame",void 0)),this.type="rexStatesImage";var i=wx(e,"effects",!0);i&&Pr(this,i),this.style=new kx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,hx);var Ex=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Tx=Phaser.Utils.Objects.IsPlainObject,Px=Phaser.Utils.Objects.GetValue;var Ox=function(t){return"string"==typeof t&&(t=Mx[t]),t};const Mx={scale:0,repeat:1};var Dx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ax={_beginDraw:ld,_drawImage:ld,_drawTileSprite:ld,_endDraw:ld,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ex),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Tx(t)?(this.stretchMode.edge=Ox(Px(t,"edge",0)),this.stretchMode.internal=Ox(Px(t,"internal",0))):(t=Ox(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lx=Phaser.Utils.Objects.IsPlainObject,Rx=Phaser.Utils.Objects.GetValue;const Fx=Phaser.GameObjects;var Bx=void 0,Ix=function(t,e){if(Bx||(Bx={},Rn(t).events.once("destroy",(function(){for(var t in Bx)Bx[t].destroy();Bx=void 0}))),!Bx.hasOwnProperty(e)){var i=Rn(t).scene.systemScene;(t=new Fx[e](i)).setOrigin(0),Bx[e]=t}return Bx[e]};const jx=Phaser.GameObjects.RenderTexture;class zx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Lx(i)?(i=Rx(u=i,"x",0),s=Rx(u,"y",0),r=Rx(u,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(r)?(r=Rx(u=r,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(a)?(a=Rx(u=a,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(o)?(o=Rx(u=o,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Rx(u,"baseFrame",void 0)):Lx(h)&&(h=Rx(u=h,"columns",void 0),l=Rx(u,"rows",void 0)),void 0===o&&(o=Rx(u,"frame",void 0)),void 0===h){var c=Rx(u,"leftWidth",void 0),d=Rx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Rx(u,"topHeight",void 0),g=Rx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Rx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Rx(u,"stretchMode",0)),this.setPreserveRatio(Rx(u,"preserveRatio",!0));var f=Rx(u,"maxFixedPartScale",1),v=Rx(u,"maxFixedPartScaleX",f),m=Rx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ax),i}(jx,"rexNinePatch")){}var Nx={_drawImage:function(t,e,i,s,r,n){var a=Ix(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ix(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(zx.prototype,Nx);let Gx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Yx=Phaser.Utils.Objects.GetValue;class Wx extends zx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Yx(e,"effects",!0);i&&Pr(this,i),this.style=new Gx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Wx.prototype,hx);const Xx=["alpha","tint","flipX","flipY"];var $x=function(t,e){if(!e)return t;for(var i=0,s=Xx.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),W();if(z===f-1)return W(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return W();function Y(t){x.push(t),w=u}function X(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function W(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,Y(S),b&&H()),V()}function $(t){u=t,Y(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Pr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Xr&&(Xr=new zr),e=Xr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Wr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Wr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Vr(t,e),a=e.x,o=e.y,Hr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Xr=void 0,Wr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,qr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,qr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Ur=void 0,qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Kr=Phaser.Utils.Objects.GetValue;var Jr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Kr(i,"color"),r=Kr(i,"lineWidth"),n=Kr(i,"fillColor"),a=Kr(i,"fillAlpha",1),o=Kr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Un:Hn,this.repeatCounter=0,this}stop(){return this.state=Vn,this}update(t,e){this.state!==Vn&&this.state!==Kn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=qn)):(this.nowTime=this.duration,this.state=Kn):this.nowTime>=0&&(this.state=Un))}get t(){var t;switch(this.state){case Vn:case Hn:case qn:t=0;break;case Un:t=this.nowTime/this.duration;break;case Kn:t=1}return Wn(t,0,1)}set t(t){(t=Wn(t,-1,1))<0?(this.state=Hn,this.nowTime=-this.delay*t):(this.state=Un,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Vn}get isDelay(){return this.state===Hn}get isCountDown(){return this.state===Un}get isRunning(){return this.state===Hn||this.state===Un}get isDone(){return this.state===Kn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Vn=0,Hn=1,Un=2,qn=3,Kn=-1;class Jn extends Gn{constructor(t,e){super(t,e),this.timer=new $n}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Zn=Phaser.Utils.Objects.GetValue,Qn=Phaser.Utils.Objects.GetAdvancedValue,ta=Phaser.Tweens.Builders.GetEaseFunction;class ea extends Jn{resetFromJSON(t){return this.timer.resetFromJSON(Zn(t,"timer")),this.setEnable(Zn(t,"enable",!0)),this.setTarget(Zn(t,"target",this.parent)),this.setDelay(Qn(t,"delay",0)),this.setDuration(Qn(t,"duration",1e3)),this.setEase(Zn(t,"ease","Linear")),this.setRepeat(Zn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ta(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ia=Phaser.Sound.BaseSound;var sa=function(t){return t instanceof ia};const ra=Phaser.Utils.Objects.GetValue,na=Phaser.Utils.Objects.GetAdvancedValue,aa=Phaser.Math.Linear;let oa=class extends ea{constructor(t,e,i){sa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ra(t,"mode",0)),this.setEnable(ra(t,"enable",!0)),this.setVolumeRange(na(t,"volume.start",this.parent.volume),na(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ha[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=aa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ha={stop:1,destroy:2};var la=function(t,e,i,s,r){sa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new oa(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ua=function(t,e,i,s){sa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new oa(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ca=Phaser.Utils.Objects.GetValue;var da={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ca(e,"loop",this.backgroundMusicLoop),mute:ca(e,"mute",this.backgroundMusicMute),volume:ca(e,"volume",this.backgroundMusicVolume),detune:ca(e,"detune",0),rate:ca(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&la(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ua(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const pa=Phaser.Utils.Objects.GetValue;var ga={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:pa(e,"loop",this.backgroundMusicLoop),mute:pa(e,"mute",this.backgroundMusic2Mute),volume:pa(e,"volume",this.backgroundMusic2Volume),detune:pa(e,"detune",0),rate:pa(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&la(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const fa=Phaser.Utils.Array.Remove,va=Phaser.Utils.Objects.GetValue;var ma={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:va(e,"mute",this.soundEffectsMute),volume:va(e,"volume",this.soundEffectsVolume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&fa(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&fa(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&la(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ua(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ua(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&la(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ua(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ua(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Da=Phaser.Utils.Objects.GetValue,Aa=new class extends Ma{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Za(this.delimiterLeft),e=Za(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=io),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=no),this.tagExpression=t,this}setValueExpression(t){return t||(t=no),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==no||this.valueExpression!==no){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Za(this.delimiterLeft),e=Za(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=so(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const no="[^=]+";var ao=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],oo=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},ho=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:oo(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},bo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},xo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},Co={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},ko={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},So=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},wo={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return So(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!So(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},_o={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Xo=Phaser.GameObjects.Zone;let Wo=class extends Xo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const $o="BG",Vo="SPRITE",Ho="TEXTBOX",Uo="TITLE",qo="CHOICE",Ko="NAMEINPUT";var Jo=!1,Zo=function(t){Jo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return th(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return eh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ioh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eoh(t).x,getChildLocalY:t=>oh(t).y};const Sh=Phaser.Math.DegToRad;var wh={updateChildRotation(t){var e=oh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=oh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return oh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return oh(t).rotation=Sh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=oh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>oh(t).rotation},_h={updateChildScale(t){var e=oh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=oh(t),i=e.parent;return e.scaleX=Ch(t.scaleX,i.scaleX),e.scaleY=Ch(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=oh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=oh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>oh(t).scaleX,getChildLocalScaleY:t=>oh(t).scaleY},Eh={updateChildVisible(t){var e=oh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=oh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),oh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),oh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=oh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>oh(t).visible},Th={updateChildAlpha(t){var e=oh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=oh(t),i=e.parent;return e.alpha=Ch(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return oh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=oh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>oh(t).alpha},Ph={updateChildActive(t){var e=oh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return oh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),oh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=oh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>oh(t).active},Oh={updateChildScrollFactor(t){var e=oh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Mh={updateCameraFilter(t){var e=oh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Dh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Ah=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Lh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Rh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Bh=Phaser.Utils.Array;var Ih={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var P=b+k*_+a*k,O=x+S*w+o*S;E.setOrigin(a,o).setPosition(P,O).setScale(f,v).setRotation(m),Ol(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(zl.prototype,Al);const Gl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Yl=Phaser.GameObjects.GetCalcMatrix;const Xl=Phaser.Renderer.Canvas.SetTransform;var Wl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Yl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},iu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const su=Phaser.Geom.Polygon.Earcut;class ru extends Kl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=su(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Zl(t,e,this,i,s,r),this.isStroked&&tu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const au=Phaser.Math.DegToRad;var ou=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Fu(t,"tl",0),this.radiusTR=Fu(t,"tr",0),this.radiusBL=Fu(t,"bl",0),this.radiusBR=Fu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?ou(e,e,e,e,180,270,!1,r,t):ou(0,0,e,e,90,0,!0,r,t):nu(0,0,t);(e=this.radiusTR)>0?this._convexTR?ou(i-e,e,e,e,270,360,!1,r,t):ou(i,0,e,e,180,90,!0,r,t):nu(i,0,t);(e=this.radiusBR)>0?this._convexBR?ou(i-e,s-e,e,e,0,90,!1,r,t):ou(i,s,e,e,270,180,!0,r,t):nu(i,s,t);(e=this.radiusBL)>0?this._convexBL?ou(e,s-e,e,e,90,180,!1,r,t):ou(0,s,e,e,360,270,!0,r,t):nu(0,s,t);return t.push(t[0],t[1]),mu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Kl{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Bu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&tu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(eu(t,this),t.fill()),this.isStroked&&(iu(t,this),t.stroke())}}},ju=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject,Nu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),dc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,uc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(pc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class fc extends zl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=gc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},zc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Nc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(zc(t));t=this.sections.join("\n");this.lines=jc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign($c,Nc,Yc,Wc);const Vc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Hc extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ic(this.parent),this.pageStartIndexes=[],this.lines=jc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Vc(t,"maxLines",void 0)),this.setPageBreak(Vc(t,"pageBreak","\f\n")),this.setText(Vc(t,"text","")),this.startLineIndex=Vc(t,"start",-1),this.endLineIndex=Vc(t,"end",void 0);var e=Vc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Ic(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Hc.prototype,$c);var Uc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Xc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(zc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},qc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},Kc=function(t,e){for(var i=void 0,s=0;s0)l=Jc(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=Jc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},Qc={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=qc(this.parent,t);n=Kc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Zc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(Qc,Uc);const td=Phaser.Utils.Objects.GetFastValue,ed=Phaser.Utils.Objects.GetValue;class id extends Bn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ed(t,"wrap",!1)),this.setTypeMode(ed(t,"typeMode",0)),this.setTypingSpeed(ed(t,"speed",333)),this.setTextCallback=td(t,"setTextCallback",null),this.setTextCallbackScope=td(t,"setTextCallbackScope",null),this.setTypingContent(td(t,"text","")),this.typingIndex=td(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=td(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=sd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=zc(t);this.textWrapEnable&&(e=function(t,e){switch(Ic(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=qc(this.parent,this.text).length,this}onTyping(){var t=Zc.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Xc(this.parent,t):this.parent.setText(t)}}const sd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(id.prototype,Qc);const rd=Phaser.Utils.Objects.GetValue;const nd={page:0,line:1};var ad=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const od=Phaser.Display.Align;var hd={center:od.CENTER,left:od.LEFT_CENTER,right:od.RIGHT_CENTER,top:od.TOP_CENTER,bottom:od.BOTTOM_CENTER,"left-top":od.TOP_LEFT,"top-left":od.TOP_LEFT,"left-center":od.LEFT_CENTER,"center-left":od.LEFT_CENTER,"left-bottom":od.BOTTOM_LEFT,"bottom-left":od.BOTTOM_LEFT,"center-top":od.TOP_CENTER,"top-center":od.TOP_CENTER,"center-center":od.CENTER,"center-bottom":od.BOTTOM_CENTER,"bottom-center":od.BOTTOM_CENTER,"right-top":od.TOP_RIGHT,"top-right":od.TOP_RIGHT,"right-center":od.RIGHT_CENTER,"center-right":od.RIGHT_CENTER,"right-bottom":od.BOTTOM_RIGHT,"bottom-right":od.BOTTOM_RIGHT},ld=function(){},ud=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ld,events:{once:ld}}},0,0,1,1);ud.setOrigin(0);var cd=0,dd=1,pd=2,gd=4,fd=6,vd=8,md=10,yd=12,bd=function(t){var e=jr(t);return t.y+e-e*t.originY},xd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},Cd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},kd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Sd=function(t){var e=Ir(t);return t.x-e*t.originX},wd=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},_d=function(t){var e=Ir(t);return t.x+e-e*t.originX},Ed=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Td=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Od=function(t){var e=jr(t);return t.y-e*t.originY},Md=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Dd=[];Dd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Cd(t,bd(e)+s),t},Dd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Cd(t,bd(e)+s),t},Dd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Cd(t,bd(e)+s),t},Dd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){kd(t,e),Td(t,i)}(t,xd(e)+i,Pd(e)+s),t},Dd[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Td(t,Pd(e)+s),t},Dd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Td(t,Pd(e)+s),t},Dd[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Md(t,Od(e)-s),t},Dd[cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Md(t,Od(e)-s),t},Dd[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Md(t,Od(e)-s),t};var Ad=function(t,e,i,s,r){return Dd[i](t,e,s,r)},Ld=function(t,e,i,s,r,n){ud.setPosition(e,i).setSize(s,r),Ad(t,ud,n)};const Rd=Phaser.Utils.Objects.GetValue,Fd=Phaser.GameObjects.Group;var Bd=function(t,e,i){return t.add.text(0,0,"")},Id=void 0;const jd=il.prototype.add;var zd=function(t){return jd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Nd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=xl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Gd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Gd(i)):i=null);else for(i=Gd(t);i&&i.name!==e;)i=Gd(i);return i},Yd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Gd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Gd(t);e;)t=e,e=Gd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Gd(e);i;){if(i===t)return!0;i=Gd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const Xd=Phaser.Utils.Array.Remove,Wd=il.prototype.remove,$d=Yd.getParentSizer;var Vd=function(t,e){for(var i=$d(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=$d(i);return this.isBackground(t)&&Xd(this.backgroundChildren,t),Wd.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Hd=Phaser.Utils.Array.Remove,Ud=Yd.getParentSizer;var qd={removeFromParentSizer(){var t=Ud(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Hd(this.backgroundChildren,t),Vd.call(this,t,e)),this},removeAllBackgrounds(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}},Kd=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};const Jd=/(\S+)\[(\d+)\]/i;const Zd=Phaser.Utils.Objects.GetValue;var Qd=function(t,e){return void 0===e?t:t[e]},tp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Zd(e,"left",0),t.right=Zd(e,"right",0),t.top=Zd(e,"top",0),t.bottom=Zd(e,"bottom",0)),t},ep={getInnerPadding(t){return Qd(this.space,t)},setInnerPadding(t,e){return tp(this.space,t,e),this},getOuterPadding(t){return Qd(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return tp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Qd(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),tp(this.getSizerConfig(t).padding,e,i),this}},ip=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},sp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},rp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},np=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ap=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},op=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},hp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},lp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var vg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Dn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},mg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ld),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ld),this.transitOutCallback=t,this}},yg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},bg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},xg={};Object.assign(xg,vg,mg,yg,bg);const Cg=Phaser.Utils.Objects.GetValue;class kg extends Bn{constructor(t,e){super(t,e),this.setTransitInTime(Cg(e,"duration.in",200)),this.setTransitOutTime(Cg(e,"duration.out",200)),this.setTransitInCallback(Cg(e,"transitIn")),this.setTransitOutCallback(Cg(e,"transitOut")),this.oneShotMode=Cg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new fg(this,{eventEmitter:!1,initState:Cg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(kg.prototype,xg);const Sg=Phaser.GameObjects.Rectangle;class wg extends Sg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Yo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const _g=Phaser.Utils.Objects.GetValue;class Eg extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(_g(t,"hitAreaMode",0)),this.setEnable(_g(t,"enable",!0)),this.setStopMode(_g(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Tg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Tg={default:0,fullWindow:1};const Pg=Phaser.Utils.Objects.GetValue;class Og extends wg{constructor(t,e){super(t,Pg(e,"color",0),Pg(e,"alpha",.8)),this.touchEventStop=new Eg(this,{hitAreaMode:1})}}var Mg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wp(t,e)},scaleDown(t,e){_p(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e)},fadeOut(t,e){jp(t,e,!1)}},Dg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e,t.alpha)},Ag=function(t,e){jp(t,e,!1)},Lg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Rg=Phaser.Utils.Objects.GetValue;let Fg=class extends kg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Bg.popUp),null==e.transitOut&&(e.transitOut=Bg.scaleDown),e.destroy=Rg(e,"destroy",!0),super(t,e);var i=Rg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Og(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Rg(i,"transitIn",Dg)),this.setCoverTransitOutCallback(Rg(i,"transitOut",Ag)));var s=Rg(e,"touchOutsideClose",!1),r=Rg(e,"duration.hold",-1),n=Rg(e,"timeOutClose",r>=0),a=Rg(e,"anyTouchClose",!1);Rg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Rg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.popUp:t=Mg.popUp;break;case Bg.fadeIn:t=Mg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.scaleDown:t=Mg.scaleDown;break;case Bg.fadeOut:t=Mg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Bg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ig=function(t){return t&&"function"==typeof t},jg={modal(t,e){return Ig(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Fg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},zg=function(t,e,i,s,r){Ig(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ng={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),fo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return zg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return zg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return zg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return zg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return zg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return zg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return zg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return zg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return zg.call(this,"shutdown",t,e,i,s),this}},Gg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Yg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Yg={},Xg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lg(t,e.x,e.y,i,s):!!(r=Gg(e,n,!0))&&Lg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const ef={press:0,pointerdown:0,release:1,pointerup:1};var sf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new tf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},rf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!nf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return af.length=0,!0;return af.length=0,!1},af=[];const of=Phaser.Utils.Objects.GetValue;class hf extends Bn{constructor(t,e){super(t,e),this._enable=void 0;var i=of(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(of(t,"enable",!0)),this.setMode(of(t,"mode",1)),this.setClickInterval(of(t,"clickInterval",100)),this.setDragThreshold(of(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=lf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?rf:Xg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new hf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class cf extends gg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const df=Phaser.Utils.Objects.GetValue;class pf extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new cf,this.parent.setInteractive(df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(df(t,"enable",!0)),this.setCooldown(df(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var gf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Xg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new pf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new pf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ff={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},vf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Af,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Lf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Af,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Xg(t,s,e,i)}}const Af=0,Lf=1,Rf="IDLE",Ff=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Distance.Between;class If extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=jf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ff(t,"time",250)),this.setTapInterval(Ff(t,"tapInterval",200)),this.setDragThreshold(Ff(t,"threshold",9)),this.setTapOffset(Ff(t,"tapOffset",10));var e=Ff(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ff(t,"maxTaps",void 0)),this.setMinTaps(Ff(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case jf:this.state=zf;break;case zf:var t=this.lastPointer;Bf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Nf,this.state=zf);break;case Nf:this.state=zf}}onDragEnd(){this.state===zf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Nf))}onDrag(){this.state!==jf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===zf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=jf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Nf:this.state=jf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Nf&&(this.state=jf)}get isTapped(){return this.state===Nf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const jf="IDLE",zf="BEGIN",Nf="RECOGNIZED",Gf=Phaser.Utils.Objects.GetValue;class Yf extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Xf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Gf(t,"threshold",9)),this.setHoldTime(Gf(t,"time",251)),this}onDragStart(){this.state=Wf,0===this.holdTime&&(this.state=$f)}onDragEnd(){this.state=Xf}onDrag(){this.state!==Xf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Xf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Wf&&t-this.pointer.downTime>=this.holdTime&&(this.state=$f))}get isPressed(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Xf="IDLE",Wf="BEGIN",$f="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Vf=function(t){return Rn(t).loop.delta};const Hf=Phaser.Math.Distance.Between,Uf=Phaser.Math.Angle.Between;var qf={getDt:function(){return Vf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uf(e.x,e.y,t.x,t.y)}},Kf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jf={};const Zf=Phaser.Utils.Objects.GetValue,Qf=Phaser.Math.RadToDeg;class tv extends Df{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=ev},eventEmitter:!1};this.setRecongizedStateObject(new gg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zf(t,"threshold",10)),this.setVelocityThreshold(Zf(t,"velocityThreshold",1e3)),this.setDirectionMode(Zf(t,"dir","8dir")),this}onDragStart(){this.state=iv}onDragEnd(){this.state=ev}onDrag(){this.state===iv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=sv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sv&&(this.state=ev)}get isSwiped(){return this.state===sv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Kf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jf),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Qf(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(tv.prototype,qf);const ev="IDLE",iv="BEGIN",sv="RECOGNIZED",rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Array.SpliceOne,av=Phaser.Math.Distance.Between,ov=Phaser.Math.Angle.Between;class hv{constructor(t,e){var i=Dn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(rv(e,"inputConfig",void 0)),this.setEventEmitter(rv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(rv(t,"enable",!0)),this.bounds=rv(t,"bounds",void 0),this.tracerState=uv,this.pointers.length=0,oo(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,oo(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case uv:this.tracerState=cv,this.onDrag1Start();break;case cv:this.tracerState=dv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],nv(this.pointers,e),this.tracerState){case cv:this.tracerState=uv,this.onDrag1End();break;case dv:this.tracerState=cv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case cv:this.onDrag1();break;case dv:this.onDrag2()}}}dragCancel(){return this.tracerState===dv&&this.onDrag2End(),this.pointers.length=0,oo(this.movedState),this.tracerState=uv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return av(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return ov(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;lv.x=e.x-i.x,lv.y=e.y-i.y}else lv.x=0,lv.y=0;return lv}get centerX(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==dv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==dv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=pv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Xg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Xg(t,s,e,i)}}Object.assign(hv.prototype,hr);var lv={};const uv=0,cv=1,dv=2,pv="IDLE";Phaser.Utils.Objects.GetValue;const gv=Phaser.Math.RotateAround;var fv=function(t,e,i,s){return gv(t,e,i,s),t.rotation+=s,t},vv={};const mv=Phaser.Utils.Objects.GetValue,yv=Phaser.Math.Angle.WrapDegrees,bv=Phaser.Math.Angle.ShortestBetween,xv=Phaser.Math.RadToDeg,Cv=Phaser.Math.DegToRad;var kv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=vv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.state=_v}break;case _v:t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_v}get rotation(){return Cv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,kv);const Sv="IDLE",wv="BEGIN",_v="RECOGNIZED",Ev=Phaser.Utils.Objects.GetValue;var Tv=function(t){var e=Ev(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new If(this,e),this._tap.on("tap",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Pv=Phaser.Utils.Objects.GetValue;var Ov=function(t){var e=Pv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Yf(this,e),this._press.on("pressstart",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new tv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";mf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Av=Phaser.Utils.Objects.GetValue;var Lv=function(t,e){return t.setInteractive(),Av(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Av(e,"targets",[t]),targetMode:Av(e,"targetMode","parent"),eventEmitter:Av(e,"eventEmitter",t),eventNamePrefix:Av(e,"inputEventPrefix","child.")},bf.call(t,e),kf.call(t,e),_f.call(t,e),Of.call(t,e),Tv.call(t,e),Ov.call(t,e),Dv.call(t,e),t},Rv={getSizerConfig:function(t){return void 0===t&&(t=this),ad(t)},getChildPrevState:function(t){var e=ad(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=an(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Rd(e,"color"),s=Rd(e,"lineWidth");var h=Rd(e,"name",!1);h&&(r=Rd(h,"createTextCallback",Bd),n=Rd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Rd(h,"align","left-top"))&&(a=hd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Fd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var u,c,d=this.getAllShownChildren([this]),p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Xv=Phaser.Utils.Objects.IsPlainObject,Wv=Phaser.Utils.Objects.GetValue,$v=Phaser.Display.Align.CENTER,Vv={min:0,full:-1};var Hv=function(t,e,i,s,r,n,a,o,h,l,u,c){zd.call(this,t);var d=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=Vv[e];else if(Xv(e)){var g;e=Wv(g=e,"proportion",void 0),i=Wv(g,"align",$v),s=Wv(g,"padding",0),r=Wv(g,"expand",!1),n=Wv(g,"key",void 0),a=Wv(g,"index",void 0),t.isRexSizer||(o=Wv(g,"minWidth",void 0),h=Wv(g,"minHeight",void 0)),l=Wv(g,"fitRatio",0),u=Wv(g,"offsetX",0),c=Wv(g,"offsetY",0)}return"string"==typeof i&&(i=hd[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=$v),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),void 0===u&&(u=0),void 0===c&&(c=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=xl(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=u,g.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Uv={add:Hv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Hv.call(this,new Gv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Xv(i)&&(i.index=t),Hv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Yv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const qv=il.prototype.clear;var Kv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kv.call(this,t),this}},Qv={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=hd[e]),this.getSizerConfig(t).align=e,this}},tm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},em={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},im={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},sm={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(dp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,lp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||sp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&zv.call(this,t,void 0),rp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ap.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&zv.call(this,void 0,t),op.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(sm,Uv,Zv,Qv,tm,em,im);var rm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},nm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},am=function(t){return"string"==typeof t&&(t=nm[t]),t};const om=Phaser.Utils.Objects.IsPlainObject,hm=Phaser.Utils.Objects.GetValue;class lm extends Bv{constructor(t,e,i,s,r,n,a){om(e)?(e=hm(a=e,"x",0),i=hm(a,"y",0),s=hm(a,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(s)?(s=hm(a=s,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(n)&&(n=hm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(hm(a,"space.item",0)),this.setStartChildIndex(hm(a,"startChildIndex",0)),this.setRTL(hm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=am(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=rm.call(this)),this._childrenProportion}}Object.assign(lm.prototype,sm);var um=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},cm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},dm={appendText:cm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class pm extends lm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(um(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(um(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&um(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&um(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(pm.prototype,dm);var gm=function(t,e,i,s){var r=new Sl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const fm=Phaser.Utils.Objects.GetValue;const vm=Phaser.Utils.Objects.GetValue;var mm=/^[\x00-\x7F]+$/,ym=function(t){return mm.test(t)},bm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Cm=0,km=1,Sm=2,wm=0,_m=1,Em=2,Tm=/(?:\r\n|\r|\n)/;const Pm={none:wm,word:_m,char:Em,character:Em,mix:3};var Om=function(t,e){switch(Ic(t)){case 0:switch("string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=bm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e}};const Mm=Phaser.Renderer.WebGL.Utils;var Dm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Mm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Am=Phaser.Display.Color;var Lm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Am);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Rm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Fm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Rm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Zo();const Bm=Phaser.Display.Canvas.CanvasPool,Im=Phaser.GameObjects.GameObject,jm=Phaser.Utils.String.UUID;class zm extends Im{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Bm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=jm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Bm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Nm=Phaser.GameObjects.Components;Phaser.Class.mixin(zm,[Nm.Alpha,Nm.BlendMode,Nm.Crop,Nm.Depth,Nm.Flip,Nm.GetBounds,Nm.Mask,Nm.Origin,Nm.Pipeline,Nm.PostPipeline,Nm.ScrollFactor,Nm.Tint,Nm.Transform,Nm.Visible,Dm,Lm,Fm]);let Gm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Gm.prototype,ql);var Ym={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Xm=Phaser.Math.RotateAround;var Wm;const $m=Phaser.Geom.Rectangle;var Vm,Hm=function(t){void 0===Vm&&(Vm=new $m);var e=t.drawTLX,i=t.drawTLY;return Vm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Vm};const Um=Phaser.Math.RotateAround;var qm,Km=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===qm&&(qm={}),s=qm),s.x=e,s.y=i,0!==t.rotation&&Um(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Jm=Phaser.GameObjects.Components.TransformMatrix;var Zm,Qm,ty={},ey=function(t,e,i,s,r){var n=Km(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ty);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Zm&&(Zm=new Jm,Qm=new Jm),t.parentContainer?t.getWorldTransformMatrix(Zm,Qm):Zm.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Zm.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},iy=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ey(t,e,n,a,r)},sy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Wm&&(Wm={}),s=Wm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Xm(s,0,0,-i.rotation),s}(t,e,this,!0);return Hm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return iy(this.parent,this,t,e,i)}};Object.assign(sy,Ym);const ry=Phaser.Math.DegToRad,ny=Phaser.Math.RadToDeg,ay=Phaser.Utils.Objects.GetValue;class oy extends Gm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ny(this._rotation)}set angle(t){this.rotation=ry(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ay(t,"width",void 0),i=ay(t,"height",void 0),s=ay(t,"scaleX",void 0),r=ay(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oy.prototype,sy);const hy=Phaser.Utils.String.Pad;var ly=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},uy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const cy=Phaser.Utils.Objects.GetValue;let dy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=cy(t,"x",0),i=cy(t,"y",0));var s=this.cornerRadius;s.tl=py(cy(t,"tl",void 0),e,i),s.tr=py(cy(t,"tr",void 0),e,i),s.bl=py(cy(t,"bl",void 0),e,i),s.br=py(cy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gy(this.cornerRadius.br,t)}};var py=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),fy(t),t},gy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=cy(e,"x",0),t.y=cy(e,"y",0)),fy(t)},fy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vy=Phaser.Math.DegToRad;var my=function(t){return!t.hasOwnProperty("convex")||t.convex},yy=function(t){return t.x>0&&t.y>0},by=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,l,h,l,180,270,!1,a):by(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,l,h,l,270,360,!1,a):by(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,r-l,h,l,0,90,!1,a):by(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,r-l,h,l,90,180,!1,a):by(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Cy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),xy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const ky=Phaser.Utils.Objects.GetValue;class Sy extends oy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ky(e,"color",null),ky(e,"color2",null),ky(e,"horizontalGradient",!0)),this.setStroke(ky(e,"stroke",null),ky(e,"strokeThickness",2)),this.setCornerRadius(ky(e,"cornerRadius",0),ky(e,"cornerIteration",null))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ly(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,uy("color2",t,this),uy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Cy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wy=Phaser.Utils.Objects.GetValue;class _y extends oy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wy(e,"color",null),wy(e,"color2",null),wy(e,"horizontalGradient",!0)),this.setStroke(wy(e,"stroke",null),wy(e,"strokeThickness",2))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ly(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,wy(t,"color2",null),wy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ey=Phaser.Utils.Objects.GetValue;let Ty=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ey(t,"bold",!1)),this.setItalic(Ey(t,"italic",!1)),this.setFontSize(Ey(t,"fontSize","16px")),this.setFontFamily(Ey(t,"fontFamily","Courier")),this.setColor(Ey(t,"color","#fff")),this.setStrokeStyle(Ey(t,"stroke",null),Ey(t,"strokeThickness",0)),this.setShadow(Ey(t,"shadowColor",null),Ey(t,"shadowOffsetX",0),Ey(t,"shadowOffsetY",0),Ey(t,"shadowBlur",0)),this.setOffset(Ey(t,"offsetX",0),Ey(t,"offsetY",0)),this.setSpace(Ey(t,"leftSpace",0),Ey(t,"rightSpace",0)),this.setAlign(Ey(t,"align",void 0)),this.setBackgroundColor(Ey(t,"backgroundColor",null)),this.setBackgroundHeight(Ey(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ey(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(uy("stroke",t,this),uy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uy("shadowOffsetX",t,this),uy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ly(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ly(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ly(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ly(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Py=Phaser.Utils.Array.Remove;const Oy=Phaser.Utils.Array.Remove;const My="text",Dy="image",Ay="drawer",Ly="space",Ry="command";var Fy=function(t){return t.type===My&&"\n"===t.text},By=function(t){return t.type===My&&"\f"===t.text},Iy=function(t){return t.type===My};class jy extends oy{constructor(t,e,i){super(t,My),this.updateTextFlag=!1,this.style=new Ty(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var zy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ny=Phaser.Display.Canvas.CanvasPool;var Gy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Ny.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Ny.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Yy extends oy{constructor(t,e,i){super(t,Dy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Gy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Xy extends oy{constructor(t,e,i,s){super(t,Ay),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Wy extends oy{constructor(t,e){super(t,Ly),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class $y extends Gm{constructor(t,e,i,s,r){super(t,Ry),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Vy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Hy={none:0,word:1,char:2,character:2,mix:3};var Uy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=Zy.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=Zy.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=tb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=tb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=tb(t,"wrapMode");void 0===c&&(c=tb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Hy[c]);var d=tb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=tb(t,"letterSpacing",0),g=tb(t,"hAlign",0),f=tb(t,"vAlign",0),v=tb(t,"justifyPercentage",.25),m=Vy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(O.push({children:M,width:D}),A=Math.max(A,D)),m.start+=P.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=O.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=sb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=sb(t,"maxLines",0);var o=0===i,h=sb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=sb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=sb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=sb(t,"letterSpacing",0),p=sb(t,"rtl",!0),g=sb(t,"hAlign",p?2:0),f=sb(t,"vAlign",0),v=Vy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(P.push({children:O,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=P.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return tp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Qd(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Py(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Oy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(My);return null===i?i=new jy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),iy(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Ib(t,r,e,i,n),o=0;o<=Rb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ib(t,r,e,i,n)}return o===Rb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),jb(t,e,i),t},Bb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ib=function(t,e,i,s,r){var n,a=Bb(t,e,r),o=Bb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},jb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zb=Phaser.Utils.Objects.GetValue;var Nb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zb(e,"minWidth",0),s=zb(e,"minHeight",0),r=zb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Fb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Fb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Gb=Phaser.Utils.Objects.GetValue,Yb=[function(t){var e=this.scene,i=fm(t,"orientation",0);this.setOrientation(i);var s=fm(t,"icon",void 0),r=fm(t,"iconMask",void 0),n=fm(t,"innerBackground",void 0),a=fm(t,"title",void 0),o=fm(t,"separator",void 0),h=fm(t,"text",void 0),l=fm(t,"action",void 0),u=fm(t,"actionMask",void 0);if(s){var c=fm(t,"align.icon","center");m=0===this.orientation?{right:fm(t,"space.icon",0),top:fm(t,"space.iconTop",0),bottom:fm(t,"space.iconBottom",0),left:fm(t,"space.iconLeft",0)}:{bottom:fm(t,"space.icon",0),left:fm(t,"space.iconLeft",0),right:fm(t,"space.iconRight",0),top:fm(t,"space.iconTop",0)};var d=fm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=gm.call(this,s,s,1)),!d){var p=fm(t,"iconSize",void 0);this.setIconSize(fm(t,"iconWidth",p),fm(t,"iconHeight",p))}}var g=new lm(e,{orientation:1});n&&g.addBackground(n);var f=fm(t,"space.separator",0);if(a){c=fm(t,"align.title","left");var v=fm(t,"expandTitleWidth",!1);y=fm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?fm(t,"space.title",f):0,left:fm(t,"space.titleLeft",0),right:fm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:fm(t,"space.separatorLeft",0),right:fm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=fm(t,"align.text","left");var y,b,x=fm(t,"expandTextWidth",!1);y=fm(t,"expandTextHeight",!1)?1:0,b=x,m={left:fm(t,"space.textLeft",0),right:fm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:fm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=fm(t,"align.action","center");m=0===this.orientation?{top:fm(t,"space.actionTop",0),bottom:fm(t,"space.actionBottom",0),right:fm(t,"space.actionRight",0)}:{left:fm(t,"space.actionLeft",0),right:fm(t,"space.actionRight",0),bottom:fm(t,"space.actionBottom",0)};d=fm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=gm.call(this,l,l,1)),!d){var C=fm(t,"actionSize");this.setActionSize(fm(t,"actionWidth",C),fm(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=vm(t,"title",void 0),s=vm(t,"separator",void 0),r=vm(t,"innerBackground",void 0),n=vm(t,"icon",void 0),a=vm(t,"iconMask",void 0),o=vm(t,"text",void 0),h=vm(t,"action",void 0),l=vm(t,"actionMask",void 0);if(i){var u=vm(t,"align.title","left"),c=vm(t,"expandTitleWidth",!1);y=vm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:vm(t,"space.title",0),left:vm(t,"space.titleLeft",0),right:vm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=vm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:vm(t,"space.separatorLeft",0),right:vm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=vm(t,"orientation",0),f=new lm(e,{orientation:g,rtl:vm(t,"rtl",!1),space:{left:vm(t,"space.innerLeft",0),right:vm(t,"space.innerRight",0),top:vm(t,"space.innerTop",0),bottom:vm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=vm(t,"align.icon","center");p=0===f.orientation?{right:vm(t,"space.icon",0),top:vm(t,"space.iconTop",0),bottom:vm(t,"space.iconBottom",0),left:vm(t,"space.iconLeft",0)}:{bottom:vm(t,"space.icon",0),left:vm(t,"space.iconLeft",0),right:vm(t,"space.iconRight",0),top:vm(t,"space.iconTop",0)};var v=vm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=gm.call(this,n,n,1)),!v){var m=vm(t,"iconSize",void 0);this.setIconSize(vm(t,"iconWidth",m),vm(t,"iconHeight",m))}}if(o){u=vm(t,"align.text","left");var y,b,x=vm(t,"space.text",0),C=vm(t,"expandTextWidth",!1),k=vm(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=vm(t,"align.action","center");p=0===f.orientation?{top:vm(t,"space.actionTop",0),bottom:vm(t,"space.actionBottom",0),right:vm(t,"space.actionRight",0)}:{left:vm(t,"space.actionLeft",0),right:vm(t,"space.actionRight",0),bottom:vm(t,"space.actionBottom",0)};v=vm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=gm.call(this,h,h,1)),!v){var S=vm(t,"actionSize");this.setActionSize(vm(t,"actionWidth",S),vm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Xb extends pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Gb(e,"background",void 0);i&&this.addBackground(i);var s=Gb(e,"title",void 0),r=Gb(e,"text",void 0);if(s){var n=Gb(e,"wrapTitle",!1),a=Gb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Om(s,n),e.expandTitleWidth=!0,Lb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(s,{fitHeight:!0}))}if(r){var o=Gb(e,"wrapText",!1),h=Gb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Om(r,o),e.expandTextWidth=!0,Lb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(r,{fitHeight:!0}))}var l=Gb(e,"layoutMode",0);(Yb[l]||Yb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Wb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=rd(i,"expandTextWidth",!1),n=rd(i,"expandTextHeight",!1);if(r||n){var a=Ic(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(rd(i,"typingMode","page")),this.page=new Hc(s,rd(i,"page",void 0)),this.typing=new id(s,rd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=nd[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Xb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const $b=Phaser.GameObjects.GetCalcMatrix;const Vb=Phaser.Renderer.Canvas.SetTransform;var Hb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$b(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Zl(r,a,e,l,o,h),e.isStroked&&tu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Vb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(qb.prototype,Hb);var Kb=function(t){return t.x>0&&t.y>0};const Jb=Phaser.Utils.Objects.IsPlainObject,Zb=Phaser.Utils.Objects.GetValue,Qb=Phaser.Geom.Polygon.Earcut;class tx extends qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(Jb(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new dy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=Zb(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(Zb(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,Kb(i))if(i.convex){var o=i.x,h=i.y;ou(o,h,i.x,i.y,180,270,!1,a,e)}else{ou(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else nu(0,0,e);if(i=n.tr,Kb(i))if(i.convex){o=s-i.x,h=i.y;ou(o,h,i.x,i.y,270,360,!1,a,e)}else{ou(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else nu(s,0,e);if(i=n.br,Kb(i))if(i.convex){o=s-i.x,h=r-i.y;ou(o,h,i.x,i.y,0,90,!1,a,e)}else{ou(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else nu(s,r,e);if(i=n.bl,Kb(i))if(i.convex){o=i.x,h=r-i.y;ou(o,h,i.x,i.y,90,180,!1,a,e)}else{ou(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else nu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Qb(e),this}setShapeType(t){return"string"==typeof t&&(t=ex[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const ex={rectangle:0,circle:1};var ix=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},sx=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dx=Phaser.Utils.Objects.GetValue,px=Phaser.Utils.Objects.IsPlainObject;class gx extends(sc(Hl)){constructor(t,e,i,s,r,n,a,o){px(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):px(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):px(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(dx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dx(o,"trackStrokeThickness",2),dx(o,"trackStrokeColor",void 0)),this.setSkewX(dx(o,"skewX",0)),this.setRTL(dx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var fx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&cx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),cx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&cx(o,0,0,e,i,t)}};Object.assign(gx.prototype,fx);class vx extends gx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=mx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const mx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(vx.prototype,hx);let yx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const bx=Phaser.GameObjects.NineSlice,xx=Phaser.Utils.Objects.GetValue;class Cx extends bx{constructor(t,e){void 0===e&&(e={}),super(t,xx(e,"x",0),xx(e,"y",0),xx(e,"key",null),xx(e,"frame",null),xx(e,"width",0),xx(e,"height",0),xx(e,"leftWidth",0),xx(e,"rightWidth",0),xx(e,"topHeight",0),xx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=xx(e,"effects",!0);i&&Pr(this,i),this.style=new yx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cx.prototype,hx);let kx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Sx=Phaser.GameObjects.Image,wx=Phaser.Utils.Objects.GetValue;class _x extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",""),wx(e,"frame",void 0)),this.type="rexStatesImage";var i=wx(e,"effects",!0);i&&Pr(this,i),this.style=new kx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,hx);var Ex=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Tx=Phaser.Utils.Objects.IsPlainObject,Px=Phaser.Utils.Objects.GetValue;var Ox=function(t){return"string"==typeof t&&(t=Mx[t]),t};const Mx={scale:0,repeat:1};var Dx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ax={_beginDraw:ld,_drawImage:ld,_drawTileSprite:ld,_endDraw:ld,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ex),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Tx(t)?(this.stretchMode.edge=Ox(Px(t,"edge",0)),this.stretchMode.internal=Ox(Px(t,"internal",0))):(t=Ox(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lx=Phaser.Utils.Objects.IsPlainObject,Rx=Phaser.Utils.Objects.GetValue;const Fx=Phaser.GameObjects;var Bx=void 0,Ix=function(t,e){if(Bx||(Bx={},Rn(t).events.once("destroy",(function(){for(var t in Bx)Bx[t].destroy();Bx=void 0}))),!Bx.hasOwnProperty(e)){var i=Rn(t).scene.systemScene;(t=new Fx[e](i)).setOrigin(0),Bx[e]=t}return Bx[e]};const jx=Phaser.GameObjects.RenderTexture;class zx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Lx(i)?(i=Rx(u=i,"x",0),s=Rx(u,"y",0),r=Rx(u,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(r)?(r=Rx(u=r,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(a)?(a=Rx(u=a,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(o)?(o=Rx(u=o,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Rx(u,"baseFrame",void 0)):Lx(h)&&(h=Rx(u=h,"columns",void 0),l=Rx(u,"rows",void 0)),void 0===o&&(o=Rx(u,"frame",void 0)),void 0===h){var c=Rx(u,"leftWidth",void 0),d=Rx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Rx(u,"topHeight",void 0),g=Rx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Rx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Rx(u,"stretchMode",0)),this.setPreserveRatio(Rx(u,"preserveRatio",!0));var f=Rx(u,"maxFixedPartScale",1),v=Rx(u,"maxFixedPartScaleX",f),m=Rx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ax),i}(jx,"rexNinePatch")){}var Nx={_drawImage:function(t,e,i,s,r,n){var a=Ix(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ix(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(zx.prototype,Nx);let Gx=class extends Bn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Yx=Phaser.Utils.Objects.GetValue;class Xx extends zx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Yx(e,"effects",!0);i&&Pr(this,i),this.style=new Gx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xx.prototype,hx);const Wx=["alpha","tint","flipX","flipY"];var $x=function(t,e){if(!e)return t;for(var i=0,s=Wx.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const sC=Phaser.Display.Canvas.CanvasPool;var rC=function(t){var e=sC.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return sC.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,sC.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==wm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Pm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=aC(t,l,u);else{var d=nC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=aC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=aC(t,"fill",null);null!==g&&(this.color=ly(g));var f=aC(t,"metrics",!1);return f?this.metrics={ascent:aC(f,"ascent",0),descent:aC(f,"descent",0),fontSize:aC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=rC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=rC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=aC(t,"fontFamily","Courier"),this.fontSize=aC(t,"fontSize","16px"),this.fontStyle=aC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ly(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ly(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ly(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ly(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ly(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ly(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ly(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Pm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=aC(e,"fontFamily",this.fontFamily),this.fontSize=aC(e,"fontSize",this.fontSize),this.fontStyle=aC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var hC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Cy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const lC=Phaser.Utils.Objects.GetValue,uC=Cm,cC=km;class dC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=lC(t,"text",""),this.x=lC(t,"x",0),this.y=lC(t,"y",0),this.width=lC(t,"width",0);var e=lC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=lC(t,"newLineMode",0),this.startIndex=lC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===cC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==uC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===cC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const pC=Phaser.Utils.Objects.GetFastValue,gC=Cm,fC=Sm;class vC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=pC(t,"tagToText",ld),this.tagToTextScope=pC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var mC={};const yC=Phaser.Geom.Rectangle;var bC=new Ma;class xC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&RC(f)){""!==b?a.push(n.getLine(b,x,TC)):0===C&&r>0&&a.push(n.getLine("",0,TC)),a.push(...AC(f,e,MC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,TC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},LC=function(t,e){var i;switch(e){case OC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==BC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new vC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Wk(this.sizerChildren,null),Kv.call(this,t),this}},$k={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Wk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},qk={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Wk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Wk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Jk=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Zk=Phaser.Utils.Objects.IsPlainObject,Qk=Phaser.Utils.Objects.GetValue;class tS extends Bv{constructor(t,e,i,s,r,n,a,o,h,l){Zk(e)?(e=Qk(l=e,"x",0),i=Qk(l,"y",0),s=Qk(l,"width",void 0),r=Qk(l,"height",void 0),n=Qk(l,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(s)?(s=Qk(l=s,"width",void 0),r=Qk(l,"height",void 0),n=Qk(l,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(n)?(n=Qk(l=n,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(o)&&(o=Qk(l=o,"columnProportions",0),h=Qk(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Qk(l,"createCellContainerCallback")),this.setIndentLeft(Qk(l,"space.indentLeftOdd",0),Qk(l,"space.indentLeftEven",0)),this.setIndentTop(Qk(l,"space.indentTopOdd",0),Qk(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Qk(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Kk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Jk.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(tS.prototype,qk);const eS=Phaser.Utils.Objects.GetValue;const iS=Phaser.Math.Percent;var sS=function(t,e,i){var s;return t.y===e.y?s=iS(i.x,t.x,e.x):t.x===e.x&&(s=iS(i.y,t.y,e.y)),s},rS=function(t,e,i){var s,r;this.enable&&(nS.x=e,nS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=sS(s,r,nS))},nS={},aS=function(t,e,i){if(this.enable&&t.isDown){var s,r;oS.x=t.worldX,oS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=sS(s,r,oS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},oS={},hS=function(t,e){void 0===e&&(e=lS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Ld(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},lS={};const uS=Phaser.Display.Align.LEFT_CENTER,cS=Phaser.Display.Align.TOP_CENTER;var dS={};const pS=Phaser.Display.Align.RIGHT_CENTER,gS=Phaser.Display.Align.BOTTOM_CENTER;var fS={};const vS=Phaser.Math.Linear;var mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER,xS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;const kS=Phaser.Utils.Objects.GetValue,SS=Phaser.Utils.Objects.IsPlainObject,wS=Phaser.Math.Clamp,_S=Phaser.Math.Snap.To;class ES extends(sc(lm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=kS(e,"reverseAxis",!1);var i=kS(e,"background",void 0),s=kS(e,"track",void 0),r=kS(e,"indicator",void 0),n=kS(e,"thumb",void 0);if(i&&(SS(i)&&(i=Vx(t,i)),this.addBackground(i)),s&&(SS(s)&&(s=Vx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(SS(r)&&(r=Vx(t,r)),this.pin(r)),n){SS(n)&&(n=Vx(t,n)),this.pin(n);var a=kS(e,"thumbOffsetX",0),o=kS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=kS(e,"input",0);switch("string"==typeof h&&(h=TS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",rS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",aS,this).on("pointermove",aS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(kS(e,"enable",void 0)),this.setGap(kS(e,"gap",void 0)),this.setValue(kS(e,"value",0),kS(e,"min",void 0),kS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=_S(t,this.gap));var e=this._value;this._value=wS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const TS={pan:0,drag:0,click:1,none:-1};var PS={getStartPoint:function(t){if(void 0===t&&(t=dS),this.childrenMap.thumb){var e=0===this.orientation?uS:cS;hS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;hS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=mS),s.x=vS(e.x,i.x,t),s.y=vS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;dp(e,i,s),r=n?0===this.orientation?xS:CS:0===this.orientation?yS:bS,Ad(e,this,r),this.resetChildPositionState(e)}};Object.assign(ES.prototype,PS);const OS=Phaser.Utils.Objects.GetValue;class MS extends lm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=OS(e,"background",void 0),r=OS(e,"buttons",void 0),n=OS(r,"top",OS(r,"left",void 0)),a=OS(r,"bottom",OS(r,"right",void 0)),o=OS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new pf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===OS(o,"width",void 0)?1:0;else h=void 0===OS(o,"height",void 0)?1:0;i=new ES(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new pf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=OS(e,"valuechangeCallback",null);if(null!==u){var c=OS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(OS(e,"enable",void 0)),this.setValue(OS(e,"value",0)),this.setScrollStep(OS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class DS extends gg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const AS=Phaser.Utils.Objects.GetValue,LS=Phaser.Math.Distance.Between;class RS extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=AS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(AS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(AS(t,"enable",!0)),this.holdThreshold=AS(t,"holdThreshold",50),this.pointerOutReleaseEnable=AS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Vf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:LS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Wg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Wg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const FS=Phaser.Utils.Objects.GetValue;class BS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(FS(t,"value",0)),this.setSpeed(FS(t,"speed",0)),this.setAcceleration(FS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class IS{constructor(){this.value,this.dir,this.movement=new BS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const GS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},YS=Phaser.Utils.Objects.GetValue;class WS extends Bn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=YS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(YS(e,"speed",.1)),this.setEnable(YS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(YS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Wg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const XS=Phaser.Utils.Objects.GetValue;var $S=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?XS(s,l,void 0):XS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=ho(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new MS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=XS(r,"position",0);"string"==typeof p&&(p=VS[p]);var g,f,v=XS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=XS(s,"space.slider",void 0))&&(o?v=0:g=XS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:XS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:XS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:XS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:XS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=XS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=XS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=XS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=XS(s,"scrollDetectionMode");"string"==typeof b&&(b=HS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?XS(s,x,!0):XS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new NS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=XS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new WS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const VS={right:0,left:1,bottom:0,top:1},HS={gameObject:0,rectBounds:1},US=Phaser.Utils.Objects.GetValue;var qS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=US(e,"width"),a=US(e,"height");n||(US(e,"child.expandWidth",!0)||(s[1]=0));a||(US(e,"child.expandHeight",!0)||(r[1]=0));var o=new tS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=eS(i,"child"),r=eS(s,"gameObject",void 0);if(r){var n=eS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=eS(n,"top",0),a.bottom=eS(n,"bottom",0),o.left=eS(n,"left",0),o.right=eS(n,"right",0);break;case 1:a.top=eS(n,"left",0),a.bottom=eS(n,"right",0),o.top=eS(n,"top",0),o.bottom=eS(n,"bottom",0);break;default:a.top=eS(n,"top",0),a.bottom=eS(n,"bottom",0),a.left=eS(n,"left",0),a.right=eS(n,"right",0)}e.add(r,{column:1,row:1,align:eS(s,"align","center"),padding:o,expand:{width:eS(s,"expandWidth",!0),height:eS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:$S(t,o,"y",e);break;case 1:$S(t,o,"x",e);break;default:$S(t,o,"y",e),$S(t,o,"x",e)}return o},KS=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},JS=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},ZS=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var fw=function(t){return t.add.text(0,0,"")};Object.assign(gw.prototype,uw);var vw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},mw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const yw=Phaser.Utils.Objects.GetValue;class bw extends iw{constructor(t,e){void 0===e&&(e={});var i=yw(e,"text",void 0),s=yw(e,"textWidth",void 0),r=yw(e,"textHeight",void 0),n=yw(e,"textCrop",!!i.setCrop),a=yw(e,"textMask",!n),o=yw(e,"content",""),h=new gw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:yw(e,"clampChildOY",!1),alwaysScrollable:yw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=yw(e,"space",void 0);l&&(l.child=yw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(bw.prototype,vw,mw);const xw=Phaser.Utils.Objects.GetValue;var Cw=function(t,e,i){e=e?y(e):{};var s=xw(i,"background",Vx),r=xw(i,"text",kw),n=xw(i,"track",Vx),a=xw(i,"thumb",Vx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new bw(t,e);return t.add.existing(h),h},kw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ok(t,e);break;case"bbcodetext":case"bbcode":s=new _k(t,0,0,"",e);break;case"label":s=new Ak(t,e);break;case"textarea":s=Cw(t,e);break;default:s=new qx(t,e)}return $x(s,e),t.add.existing(s),s},Sw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Wx(t,e):new Cx(t,e);break;case"roundRectangle":s=new lx(t,e);break;default:s=new _x(t,e)}return $x(s,e),t.add.existing(s),s};const ww=Phaser.Utils.Objects.GetValue;var _w=function(t,e,i){e=e?y(e):{};var s=ww(i,"background",Vx),r=ww(i,"text",kw),n=ww(i,"icon",Sw),a=ww(i,"action",Sw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Ew=Phaser.Utils.Objects.GetValue;var Tw=function(t,e,i){var s,r,n=Ew(i,"innerBackground",Vx),a=Ew(i,"separator",Vx),o=Ew(i,"title",kw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=_w(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Pw extends Xb{constructor(t,e,i){super(t,e=Tw(t,e,i))}}var Ow={start:function(t){return this.easeValueTask||(this.easeValueTask=new al(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Mw=Phaser.Utils.Objects.GetValue;class Dw extends Hl{constructor(t,e){super(t,Mw(e,"x",0),Mw(e,"y",0),Mw(e,"width",64),Mw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Mw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Mw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Mw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Mw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Mw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Mw(t,"color",i)),i=e?0:this.value,this.setValue(Mw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Dw.prototype,Ow);const Aw=Phaser.Math.DegToRad,Lw=Phaser.Math.Linear,Rw=Phaser.Math.Easing.Expo.In,Fw={right:0,down:1,left:2,up:3};var Bw=function(t,e,i,s,r,n,a,o,h,l,u){var c=jw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=jw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=jw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=jw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=jw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=jw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Iw={},jw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Iw.x=a*u+o*c+r,Iw.y=h*u+l*c+n,Iw},zw={setDirection(t){return"string"==typeof t&&(t=Fw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Lu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Aw(315);i=Math.cos(a),s=Math.sin(a);var o=Aw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Aw(135);i=Math.cos(a),s=Math.sin(a);o=Aw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Aw(225);i=Math.cos(a),s=Math.sin(a);o=Aw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Aw(45);i=Math.cos(a),s=Math.sin(a);o=Aw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=xl(s),H_(r)?(u.expandWidth=U_(r,"width",!1),u.expandHeight=U_(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),u.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Z_={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Vd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Kv.call(this,t),this}},Q_={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u=this.innerLeft,c=this.innerTop,d=this.innerWidth,p=this.innerHeight,g=this.sizerChildren;for(var f in g)(t=g[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,qg.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&($_.width=e.aspectRatio,$_.height=1,V_.width=o,V_.height=h,o=(l=ol($_,V_,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Iv(t,this)):dp(t,o,h),s=u+i.left*this.scaleX,n=d-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Kg.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Q_,J_,Z_);const tE=Phaser.Utils.Objects.IsPlainObject,eE=Phaser.Utils.Objects.GetValue;class iE extends Bv{constructor(t,e,i,s,r,n){tE(e)?(e=eE(n=e,"x",0),i=eE(n,"y",0),s=eE(n,"width",void 0),r=eE(n,"height",void 0)):tE(s)&&(s=eE(n=s,"width",void 0),r=eE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(iE.prototype,Q_);const sE=lm.prototype.add,rE=lm.prototype.addSpace;var nE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&rE.call(this),sE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&rE.call(this),this.hasTailSpace=s}else sE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;sE.call(this,t,{index:r,proportion:i,expand:!0})}else sE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},aE={addButton(t){if(Xg(t))for(var e=t,i=0,s=e.length;i=0;i--)lE.call(this,e[i],t);return this}},cE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},dE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,cE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},pE={add(t){return this.buttons.push(t),t._click||(t._click=new tf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),dE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=TE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=TE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const OE=Phaser.Utils.Objects.IsPlainObject,ME=Phaser.Utils.Objects.GetValue,DE=Phaser.Display.Align.CENTER;var AE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r;(zd.call(this,t),OE(e))&&(e=ME(r=e,"padding",0),i=ME(r,"key",void 0),s=ME(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=DE,r.padding=xl(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},LE={add(t,e,i){if(Xg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kv.call(this,t),this}},BE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&WE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)UE.call(this,e[i],t);return this}};const KE=Phaser.Utils.Objects.GetValue;class JE extends GE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new xE({parent:this,eventEmitter:KE(e,"eventEmitter",this),groupName:KE(e,"groupName",void 0),clickConfig:KE(e,"click",void 0)}).setButtonsType(e);var s=KE(e,"background",void 0),r=KE(e,"buttons",void 0);this.buttonsAlign=KE(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(JE.prototype,$E,qE,bE,kE);const ZE=tS.prototype.add;var QE={addButton(t,e,i){return ZE.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)iT.call(this,e[i],t);return this}};const rT=Phaser.Utils.Objects.GetValue;class nT extends tS{constructor(t,e){void 0===e&&(e={});var i=rT(e,"row",0),s=rT(e,"column",e.col||0),r=rT(e,"createCellContainerCallback"),n=rT(e,"buttons",void 0),a=rT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(eP(this),iP(this)),this}setNumberInput(){return this.onUpdateCallback=tP,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nP=Phaser.Utils.Objects.GetValue,aP=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var oP=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},hP=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=sx(t.style,e);Cl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},lP=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=sx(t,e);Cl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function uP(){}function cP(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}uP.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(cP(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const dP=new uP;const pP=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,gP=/\S/,fP=new uP;fP.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!gP.test(t)&&!gP.test(e)},fP.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(bP(t,null,null,i),i," ")},yP.equals=function(t,e){return uP.prototype.equals.call(yP,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const xP=new uP;xP.tokenize=function(t){return t.slice()},xP.join=xP.removeEmpty=function(t){return t};const CP=Phaser.Utils.Array.Remove;var kP=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),CP(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,dP.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},TP={cursorMoveLeft(){if(!this.isOpened)return this;var t=wP(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=wP(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=_P(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=wP(EP(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=_P(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=wP(EP(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const PP=Phaser.Utils.Objects.IsPlainObject;class OP extends Ab{constructor(t,e,i,s,r,n){PP(e)?n=e:PP(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Xo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=ix(n.background,"focus"),h=ix(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=nP(e,"edit");return void 0===i&&(i={}),GT(e,i,aP),new rP(t,i)}(this,n),oP.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),lP.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),hP.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new fc(t,e);return $x(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new M_(t,e);return $x(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Pw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),Cc(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=A_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=A_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(R_(e,`styles.${Ho}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ho,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{typing:Oc,shake:kc}})}},function(t,e){var{viewport:i}=e,s=wc(e,`creators.${$o}`,void 0);if(!1!==s){if(_c(s)&&(s=void 0),void 0===s){wc(e,`styles.${$o}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new fc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Cc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:$o,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:To,commands:{cross:Sc,shake:kc}})}},function(t,e){var{viewport:i}=e,s=AT(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(LT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new MT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Cc(u),u}}(AT(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{choice:DT,shake:kc}})}},function(t,e){var{viewport:i}=e,s=BP(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(IP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new RP(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Cc(u),u}}(BP(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{input:FP,shake:kc}})}},function(t,e){var{viewport:i}=e,s=W_(e,`creators.${Uo}`,void 0);if(!1!==s){var r;if(X_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new fc(t,e);return $x(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new B_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,Cc(C),C}}(W_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{setText:j_,popUp:z_,shake:kc}})}}];var zP=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],NP={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},GP=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=ho(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,NP),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=an(t,t.cameras.main));for(var a=new Eo(t,{layers:r?zo:No,layerDepth:i,rootLayer:s}),o=0,h=jP.length;oh;u--){for(c=0;c0&&this.wrapMode!==wm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Pm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=aC(t,l,u);else{var d=nC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=aC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=aC(t,"fill",null);null!==g&&(this.color=ly(g));var f=aC(t,"metrics",!1);return f?this.metrics={ascent:aC(f,"ascent",0),descent:aC(f,"descent",0),fontSize:aC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=rC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=rC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=aC(t,"fontFamily","Courier"),this.fontSize=aC(t,"fontSize","16px"),this.fontStyle=aC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ly(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ly(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ly(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ly(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ly(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ly(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ly(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ly(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Pm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=aC(e,"fontFamily",this.fontFamily),this.fontSize=aC(e,"fontSize",this.fontSize),this.fontStyle=aC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var hC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Cy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const lC=Phaser.Utils.Objects.GetValue,uC=Cm,cC=km;class dC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=lC(t,"text",""),this.x=lC(t,"x",0),this.y=lC(t,"y",0),this.width=lC(t,"width",0);var e=lC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=lC(t,"newLineMode",0),this.startIndex=lC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===cC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==uC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===cC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const pC=Phaser.Utils.Objects.GetFastValue,gC=Cm,fC=Sm;class vC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=pC(t,"tagToText",ld),this.tagToTextScope=pC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var mC={};const yC=Phaser.Geom.Rectangle;var bC=new Ma;class xC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&RC(f)){""!==b?a.push(n.getLine(b,x,TC)):0===C&&r>0&&a.push(n.getLine("",0,TC)),a.push(...AC(f,e,MC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,TC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},LC=function(t,e){var i;switch(e){case OC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==BC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new vC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Xk(this.sizerChildren,null),Kv.call(this,t),this}},$k={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Xk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},qk={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Xk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Xk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Jk=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Zk=Phaser.Utils.Objects.IsPlainObject,Qk=Phaser.Utils.Objects.GetValue;class tS extends Bv{constructor(t,e,i,s,r,n,a,o,h,l){Zk(e)?(e=Qk(l=e,"x",0),i=Qk(l,"y",0),s=Qk(l,"width",void 0),r=Qk(l,"height",void 0),n=Qk(l,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(s)?(s=Qk(l=s,"width",void 0),r=Qk(l,"height",void 0),n=Qk(l,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(n)?(n=Qk(l=n,"column",l.col||0),a=Qk(l,"row",0),o=Qk(l,"columnProportions",0),h=Qk(l,"rowProportions",0)):Zk(o)&&(o=Qk(l=o,"columnProportions",0),h=Qk(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Qk(l,"createCellContainerCallback")),this.setIndentLeft(Qk(l,"space.indentLeftOdd",0),Qk(l,"space.indentLeftEven",0)),this.setIndentTop(Qk(l,"space.indentTopOdd",0),Qk(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Qk(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Kk.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Jk.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(tS.prototype,qk);const eS=Phaser.Utils.Objects.GetValue;const iS=Phaser.Math.Percent;var sS=function(t,e,i){var s;return t.y===e.y?s=iS(i.x,t.x,e.x):t.x===e.x&&(s=iS(i.y,t.y,e.y)),s},rS=function(t,e,i){var s,r;this.enable&&(nS.x=e,nS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=sS(s,r,nS))},nS={},aS=function(t,e,i){if(this.enable&&t.isDown){var s,r;oS.x=t.worldX,oS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=sS(s,r,oS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},oS={},hS=function(t,e){void 0===e&&(e=lS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Ld(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},lS={};const uS=Phaser.Display.Align.LEFT_CENTER,cS=Phaser.Display.Align.TOP_CENTER;var dS={};const pS=Phaser.Display.Align.RIGHT_CENTER,gS=Phaser.Display.Align.BOTTOM_CENTER;var fS={};const vS=Phaser.Math.Linear;var mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER,xS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;const kS=Phaser.Utils.Objects.GetValue,SS=Phaser.Utils.Objects.IsPlainObject,wS=Phaser.Math.Clamp,_S=Phaser.Math.Snap.To;class ES extends(sc(lm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=kS(e,"reverseAxis",!1);var i=kS(e,"background",void 0),s=kS(e,"track",void 0),r=kS(e,"indicator",void 0),n=kS(e,"thumb",void 0);if(i&&(SS(i)&&(i=Vx(t,i)),this.addBackground(i)),s&&(SS(s)&&(s=Vx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(SS(r)&&(r=Vx(t,r)),this.pin(r)),n){SS(n)&&(n=Vx(t,n)),this.pin(n);var a=kS(e,"thumbOffsetX",0),o=kS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=kS(e,"input",0);switch("string"==typeof h&&(h=TS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",rS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",aS,this).on("pointermove",aS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(kS(e,"enable",void 0)),this.setGap(kS(e,"gap",void 0)),this.setValue(kS(e,"value",0),kS(e,"min",void 0),kS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=_S(t,this.gap));var e=this._value;this._value=wS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const TS={pan:0,drag:0,click:1,none:-1};var PS={getStartPoint:function(t){if(void 0===t&&(t=dS),this.childrenMap.thumb){var e=0===this.orientation?uS:cS;hS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=fS),this.childrenMap.thumb){var e=0===this.orientation?pS:gS;hS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=mS),s.x=vS(e.x,i.x,t),s.y=vS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;dp(e,i,s),r=n?0===this.orientation?xS:CS:0===this.orientation?yS:bS,Ad(e,this,r),this.resetChildPositionState(e)}};Object.assign(ES.prototype,PS);const OS=Phaser.Utils.Objects.GetValue;class MS extends lm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=OS(e,"background",void 0),r=OS(e,"buttons",void 0),n=OS(r,"top",OS(r,"left",void 0)),a=OS(r,"bottom",OS(r,"right",void 0)),o=OS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new pf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===OS(o,"width",void 0)?1:0;else h=void 0===OS(o,"height",void 0)?1:0;i=new ES(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new pf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=OS(e,"valuechangeCallback",null);if(null!==u){var c=OS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(OS(e,"enable",void 0)),this.setValue(OS(e,"value",0)),this.setScrollStep(OS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}class DS extends gg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const AS=Phaser.Utils.Objects.GetValue,LS=Phaser.Math.Distance.Between;class RS extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=AS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(AS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(AS(t,"enable",!0)),this.holdThreshold=AS(t,"holdThreshold",50),this.pointerOutReleaseEnable=AS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Vf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:LS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Xg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Xg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const FS=Phaser.Utils.Objects.GetValue;class BS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(FS(t,"value",0)),this.setSpeed(FS(t,"speed",0)),this.setAcceleration(FS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class IS{constructor(){this.value,this.dir,this.movement=new BS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const GS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},YS=Phaser.Utils.Objects.GetValue;class XS extends Bn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=YS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(YS(e,"speed",.1)),this.setEnable(YS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(YS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Xg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const WS=Phaser.Utils.Objects.GetValue;var $S=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?WS(s,l,void 0):WS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=ho(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new MS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=WS(r,"position",0);"string"==typeof p&&(p=VS[p]);var g,f,v=WS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=WS(s,"space.slider",void 0))&&(o?v=0:g=WS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:WS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:WS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:WS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:WS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=WS(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=WS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=WS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=WS(s,"scrollDetectionMode");"string"==typeof b&&(b=HS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?WS(s,x,!0):WS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new NS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=WS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new XS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const VS={right:0,left:1,bottom:0,top:1},HS={gameObject:0,rectBounds:1},US=Phaser.Utils.Objects.GetValue;var qS=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=US(e,"width"),a=US(e,"height");n||(US(e,"child.expandWidth",!0)||(s[1]=0));a||(US(e,"child.expandHeight",!0)||(r[1]=0));var o=new tS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=eS(i,"child"),r=eS(s,"gameObject",void 0);if(r){var n=eS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=eS(n,"top",0),a.bottom=eS(n,"bottom",0),o.left=eS(n,"left",0),o.right=eS(n,"right",0);break;case 1:a.top=eS(n,"left",0),a.bottom=eS(n,"right",0),o.top=eS(n,"top",0),o.bottom=eS(n,"bottom",0);break;default:a.top=eS(n,"top",0),a.bottom=eS(n,"bottom",0),a.left=eS(n,"left",0),a.right=eS(n,"right",0)}e.add(r,{column:1,row:1,align:eS(s,"align","center"),padding:o,expand:{width:eS(s,"expandWidth",!0),height:eS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:$S(t,o,"y",e);break;case 1:$S(t,o,"x",e);break;default:$S(t,o,"y",e),$S(t,o,"x",e)}return o},KS=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},JS=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},ZS=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var fw=function(t){return t.add.text(0,0,"")};Object.assign(gw.prototype,uw);var vw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},mw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const yw=Phaser.Utils.Objects.GetValue;class bw extends iw{constructor(t,e){void 0===e&&(e={});var i=yw(e,"text",void 0),s=yw(e,"textWidth",void 0),r=yw(e,"textHeight",void 0),n=yw(e,"textCrop",!!i.setCrop),a=yw(e,"textMask",!n),o=yw(e,"content",""),h=new gw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:yw(e,"clampChildOY",!1),alwaysScrollable:yw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=yw(e,"space",void 0);l&&(l.child=yw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(bw.prototype,vw,mw);const xw=Phaser.Utils.Objects.GetValue;var Cw=function(t,e,i){e=e?y(e):{};var s=xw(i,"background",Vx),r=xw(i,"text",kw),n=xw(i,"track",Vx),a=xw(i,"thumb",Vx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new bw(t,e);return t.add.existing(h),h},kw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ok(t,e);break;case"bbcodetext":case"bbcode":s=new _k(t,0,0,"",e);break;case"label":s=new Ak(t,e);break;case"textarea":s=Cw(t,e);break;default:s=new qx(t,e)}return $x(s,e),t.add.existing(s),s},Sw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Xx(t,e):new Cx(t,e);break;case"roundRectangle":s=new lx(t,e);break;default:s=new _x(t,e)}return $x(s,e),t.add.existing(s),s};const ww=Phaser.Utils.Objects.GetValue;var _w=function(t,e,i){e=e?y(e):{};var s=ww(i,"background",Vx),r=ww(i,"text",kw),n=ww(i,"icon",Sw),a=ww(i,"action",Sw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Ew=Phaser.Utils.Objects.GetValue;var Tw=function(t,e,i){var s,r,n=Ew(i,"innerBackground",Vx),a=Ew(i,"separator",Vx),o=Ew(i,"title",kw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=_w(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Pw extends Wb{constructor(t,e,i){super(t,e=Tw(t,e,i))}}var Ow={start:function(t){return this.easeValueTask||(this.easeValueTask=new al(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Mw=Phaser.Utils.Objects.GetValue;class Dw extends Hl{constructor(t,e){super(t,Mw(e,"x",0),Mw(e,"y",0),Mw(e,"width",64),Mw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Mw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Mw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Mw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Mw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Mw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Mw(t,"color",i)),i=e?0:this.value,this.setValue(Mw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Dw.prototype,Ow);const Aw=Phaser.Math.DegToRad,Lw=Phaser.Math.Linear,Rw=Phaser.Math.Easing.Expo.In,Fw={right:0,down:1,left:2,up:3};var Bw=function(t,e,i,s,r,n,a,o,h,l,u){var c=jw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=jw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=jw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=jw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=jw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=jw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Iw={},jw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Iw.x=a*u+o*c+r,Iw.y=h*u+l*c+n,Iw},zw={setDirection(t){return"string"==typeof t&&(t=Fw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Lu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Aw(315);i=Math.cos(a),s=Math.sin(a);var o=Aw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Aw(135);i=Math.cos(a),s=Math.sin(a);o=Aw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Aw(225);i=Math.cos(a),s=Math.sin(a);o=Aw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Aw(45);i=Math.cos(a),s=Math.sin(a);o=Aw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=xl(s),H_(r)?(u.expandWidth=U_(r,"width",!1),u.expandHeight=U_(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),u.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Z_={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Vd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Kv.call(this,t),this}},Q_={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u=this.innerLeft,c=this.innerTop,d=this.innerWidth,p=this.innerHeight,g=this.sizerChildren;for(var f in g)(t=g[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,qg.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&($_.width=e.aspectRatio,$_.height=1,V_.width=o,V_.height=h,o=(l=ol($_,V_,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Iv(t,this)):dp(t,o,h),s=u+i.left*this.scaleX,n=d-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Kg.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Q_,J_,Z_);const tE=Phaser.Utils.Objects.IsPlainObject,eE=Phaser.Utils.Objects.GetValue;class iE extends Bv{constructor(t,e,i,s,r,n){tE(e)?(e=eE(n=e,"x",0),i=eE(n,"y",0),s=eE(n,"width",void 0),r=eE(n,"height",void 0)):tE(s)&&(s=eE(n=s,"width",void 0),r=eE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(iE.prototype,Q_);const sE=lm.prototype.add,rE=lm.prototype.addSpace;var nE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&rE.call(this),sE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&rE.call(this),this.hasTailSpace=s}else sE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;sE.call(this,t,{index:r,proportion:i,expand:!0})}else sE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},aE={addButton(t){if(Wg(t))for(var e=t,i=0,s=e.length;i=0;i--)lE.call(this,e[i],t);return this}},cE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},dE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,cE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},pE={add(t){return this.buttons.push(t),t._click||(t._click=new tf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),dE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=TE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=TE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const OE=Phaser.Utils.Objects.IsPlainObject,ME=Phaser.Utils.Objects.GetValue,DE=Phaser.Display.Align.CENTER;var AE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r;(zd.call(this,t),OE(e))&&(e=ME(r=e,"padding",0),i=ME(r,"key",void 0),s=ME(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=DE,r.padding=xl(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},LE={add(t,e,i){if(Wg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kv.call(this,t),this}},BE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&XE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)UE.call(this,e[i],t);return this}};const KE=Phaser.Utils.Objects.GetValue;class JE extends GE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new xE({parent:this,eventEmitter:KE(e,"eventEmitter",this),groupName:KE(e,"groupName",void 0),clickConfig:KE(e,"click",void 0)}).setButtonsType(e);var s=KE(e,"background",void 0),r=KE(e,"buttons",void 0);this.buttonsAlign=KE(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(JE.prototype,$E,qE,bE,kE);const ZE=tS.prototype.add;var QE={addButton(t,e,i){return ZE.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)iT.call(this,e[i],t);return this}};const rT=Phaser.Utils.Objects.GetValue;class nT extends tS{constructor(t,e){void 0===e&&(e={});var i=rT(e,"row",0),s=rT(e,"column",e.col||0),r=rT(e,"createCellContainerCallback"),n=rT(e,"buttons",void 0),a=rT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(eP(this),iP(this)),this}setNumberInput(){return this.onUpdateCallback=tP,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const nP=Phaser.Utils.Objects.GetValue,aP=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var oP=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},hP=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=sx(t.style,e);Cl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},lP=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=sx(t,e);Cl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function uP(){}function cP(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}uP.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(cP(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const dP=new uP;const pP=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,gP=/\S/,fP=new uP;fP.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!gP.test(t)&&!gP.test(e)},fP.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(bP(t,null,null,i),i," ")},yP.equals=function(t,e){return uP.prototype.equals.call(yP,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const xP=new uP;xP.tokenize=function(t){return t.slice()},xP.join=xP.removeEmpty=function(t){return t};const CP=Phaser.Utils.Array.Remove;var kP=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),CP(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,dP.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},TP={cursorMoveLeft(){if(!this.isOpened)return this;var t=wP(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=wP(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=_P(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=wP(EP(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=_P(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=wP(EP(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const PP=Phaser.Utils.Objects.IsPlainObject;class OP extends Ab{constructor(t,e,i,s,r,n){PP(e)?n=e:PP(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Wo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=ix(n.background,"focus"),h=ix(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=nP(e,"edit");return void 0===i&&(i={}),GT(e,i,aP),new rP(t,i)}(this,n),oP.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),lP.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),hP.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new fc(t,e);return $x(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new M_(t,e);return $x(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Pw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),Cc(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=A_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=A_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(R_(e,`styles.${Ho}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ho,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{typing:Oc,shake:kc}})}},function(t,e){var{viewport:i}=e,s=wc(e,`creators.${$o}`,void 0);if(!1!==s){if(_c(s)&&(s=void 0),void 0===s){wc(e,`styles.${$o}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new fc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Cc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:$o,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:To,commands:{cross:Sc,shake:kc}})}},function(t,e){var{viewport:i}=e,s=AT(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(LT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new MT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Cc(u),u}}(AT(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{choice:DT,shake:kc}})}},function(t,e){var{viewport:i}=e,s=BP(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(IP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new RP(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Cc(u),u}}(BP(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{input:FP,shake:kc}})}},function(t,e){var{viewport:i}=e,s=X_(e,`creators.${Uo}`,void 0);if(!1!==s){var r;if(W_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new fc(t,e);return $x(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new B_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,Cc(C),C}}(X_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{setText:j_,popUp:z_,shake:kc}})}}];var zP=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],NP={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},GP=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=ho(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,NP),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=an(t,t.cameras.main));for(var a=new Eo(t,{layers:r?zo:No,layerDepth:i,rootLayer:s}),o=0,h=jP.length;o= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -61612,6 +61628,7 @@ void main () { minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexmdscenarioplugin.min.js b/dist/rexmdscenarioplugin.min.js index ee6c6ceb59..c9c7e98325 100644 --- a/dist/rexmdscenarioplugin.min.js +++ b/dist/rexmdscenarioplugin.min.js @@ -19,7 +19,7 @@ v5.4.1 https://github.com/mholt/PapaParse License: MIT - */!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(k(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!k(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=k(s.step),s.chunk=k(s.chunk),s.complete=k(s.complete),s.error=k(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&k(i.read)&&k(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround;var Yr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Xr&&(Xr=new Gr),e=Xr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Hr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Ur(t,e),a=e.x,o=e.y,Kr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Xr=void 0,Hr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},qr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zr(t,e,i)},Jr=void 0,Zr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Qr=Phaser.Utils.Objects.GetValue;var tn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qr(i,"color"),r=Qr(i,"lineWidth"),n=Qr(i,"fillColor"),a=Qr(i,"fillAlpha",1),o=Qr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Jn:qn,this.repeatCounter=0,this}stop(){return this.state=Kn,this}update(t,e){this.state!==Kn&&this.state!==Qn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Zn)):(this.nowTime=this.duration,this.state=Qn):this.nowTime>=0&&(this.state=Jn))}get t(){var t;switch(this.state){case Kn:case qn:case Zn:t=0;break;case Jn:t=this.nowTime/this.duration;break;case Qn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=qn,this.nowTime=-this.delay*t):(this.state=Jn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Kn}get isDelay(){return this.state===qn}get isCountDown(){return this.state===Jn}get isRunning(){return this.state===qn||this.state===Jn}get isDone(){return this.state===Qn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Kn=0,qn=1,Jn=2,Zn=3,Qn=-1;class ta extends Yn{constructor(t,e){super(t,e),this.timer=new Un}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ea=Phaser.Utils.Objects.GetValue,ia=Phaser.Utils.Objects.GetAdvancedValue,sa=Phaser.Tweens.Builders.GetEaseFunction;class ra extends ta{resetFromJSON(t){return this.timer.resetFromJSON(ea(t,"timer")),this.setEnable(ea(t,"enable",!0)),this.setTarget(ea(t,"target",this.parent)),this.setDelay(ia(t,"delay",0)),this.setDuration(ia(t,"duration",1e3)),this.setEase(ea(t,"ease","Linear")),this.setRepeat(ea(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=sa(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const na=Phaser.Sound.BaseSound;var aa=function(t){return t instanceof na};const oa=Phaser.Utils.Objects.GetValue,ha=Phaser.Utils.Objects.GetAdvancedValue,la=Phaser.Math.Linear;let ua=class extends ra{constructor(t,e,i){aa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(oa(t,"mode",0)),this.setEnable(oa(t,"enable",!0)),this.setVolumeRange(ha(t,"volume.start",this.parent.volume),ha(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ca[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=la(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ca={stop:1,destroy:2};var da=function(t,e,i,s,r){aa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ua(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},pa=function(t,e,i,s){aa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ua(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusicMute),volume:ga(e,"volume",this.backgroundMusicVolume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&da(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&pa(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const va=Phaser.Utils.Objects.GetValue;var ma={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:va(e,"loop",this.backgroundMusicLoop),mute:va(e,"mute",this.backgroundMusic2Mute),volume:va(e,"volume",this.backgroundMusic2Volume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&da(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ya=Phaser.Utils.Array.Remove,ba=Phaser.Utils.Objects.GetValue;var xa={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ba(e,"mute",this.soundEffectsMute),volume:ba(e,"volume",this.soundEffectsVolume),detune:ba(e,"detune",0),rate:ba(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ya(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ya(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&da(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&pa(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)pa(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&da(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&pa(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)pa(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ra=Phaser.Utils.Objects.GetValue,Ba=new class extends Aa{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=eo(this.delimiterLeft),e=eo(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=no),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ho),this.tagExpression=t,this}setValueExpression(t){return t||(t=ho),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ho||this.valueExpression!==ho){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=eo(this.delimiterLeft),e=eo(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ao(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ho="[^=]+";var lo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],uo=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},co=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:uo(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},Co={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},So={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},wo={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},To={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Po=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Po(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Po(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Oo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Ho=Phaser.GameObjects.Zone;let $o=class extends Ho{constructor(t){super(t,0,0,2,2),this.fullWindow=new Xo(this)}};const Uo="BG",Ko="SPRITE",qo="TEXTBOX",Jo="TITLE",Zo="CHOICE",Qo="NAMEINPUT";var th=!1,eh=function(t){th||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return sh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return rh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iuh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;euh(t).x,getChildLocalY:t=>uh(t).y};const Ph=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=uh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=uh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return uh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return uh(t).rotation=Ph(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=uh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>uh(t).rotation},Oh={updateChildScale(t){var e=uh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=uh(t),i=e.parent;return e.scaleX=wh(t.scaleX,i.scaleX),e.scaleY=wh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=uh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=uh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>uh(t).scaleX,getChildLocalScaleY:t=>uh(t).scaleY},Eh={updateChildVisible(t){var e=uh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=uh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),uh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),uh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=uh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>uh(t).visible},Mh={updateChildAlpha(t){var e=uh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=uh(t),i=e.parent;return e.alpha=wh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return uh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=uh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>uh(t).alpha},Dh={updateChildActive(t){var e=uh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return uh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),uh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=uh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>uh(t).active},Lh={updateChildScrollFactor(t){var e=uh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ah={updateCameraFilter(t){var e=uh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Rh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Bh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Fh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Ih=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const zh=Phaser.Utils.Array;var Nh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,_):r(c,d,_),h&&c.add.existing(P),l){var O=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(O,E).setScale(f,v).setRotation(m),Ll(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Wl.prototype,Bl);const Yl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Xl=Phaser.GameObjects.GetCalcMatrix;const Hl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Xl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},nu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const au=Phaser.Geom.Polygon.Earcut;class ou extends Ql{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=au(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&eu(t,e,this,i,s,r),this.isStroked&&su(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const lu=Phaser.Math.DegToRad;var uu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=ju(t,"tl",0),this.radiusTR=ju(t,"tr",0),this.radiusBL=ju(t,"bl",0),this.radiusBR=ju(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?uu(e,e,e,e,180,270,!1,r,t):uu(0,0,e,e,90,0,!0,r,t):hu(0,0,t);(e=this.radiusTR)>0?this._convexTR?uu(i-e,e,e,e,270,360,!1,r,t):uu(i,0,e,e,180,90,!0,r,t):hu(i,0,t);(e=this.radiusBR)>0?this._convexBR?uu(i-e,s-e,e,e,0,90,!1,r,t):uu(i,s,e,e,270,180,!0,r,t):hu(i,s,t);(e=this.radiusBL)>0?this._convexBL?uu(e,s-e,e,e,90,180,!1,r,t):uu(0,s,e,e,360,270,!0,r,t):hu(0,s,t);return t.push(t[0],t[1]),xu(this.x,this.y,t),super.updateData(),this}};const Nu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Gu={arc:du,circle:pu,curve:class extends ou{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),vc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,gc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class bc extends Wl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=yc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Vc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Yc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Vc(t));t=this.sections.join("\n");this.lines=Wc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Kc,Yc,Hc,Uc);const qc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Jc extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Gc(this.parent),this.pageStartIndexes=[],this.lines=Wc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(qc(t,"maxLines",void 0)),this.setPageBreak(qc(t,"pageBreak","\f\n")),this.setText(qc(t,"text","")),this.startLineIndex=qc(t,"start",-1),this.endLineIndex=qc(t,"end",void 0);var e=qc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Gc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Jc.prototype,Kc);var Zc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$c(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Vc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Qc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},td=function(t,e){for(var i=void 0,s=0;s0)l=ed(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=ed(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},sd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=Qc(this.parent,t);n=td(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(sd,Zc);const rd=Phaser.Utils.Objects.GetFastValue,nd=Phaser.Utils.Objects.GetValue;class ad extends zn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(nd(t,"wrap",!1)),this.setTypeMode(nd(t,"typeMode",0)),this.setTypingSpeed(nd(t,"speed",333)),this.setTextCallback=rd(t,"setTextCallback",null),this.setTextCallbackScope=rd(t,"setTextCallbackScope",null),this.setTypingContent(rd(t,"text","")),this.typingIndex=rd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=rd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=od[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Vc(t);this.textWrapEnable&&(e=function(t,e){switch(Gc(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=Qc(this.parent,this.text).length,this}onTyping(){var t=id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$c(this.parent,t):this.parent.setText(t)}}const od={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(ad.prototype,sd);const hd=Phaser.Utils.Objects.GetValue;const ld={page:0,line:1};var ud=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const cd=Phaser.Display.Align;var dd={center:cd.CENTER,left:cd.LEFT_CENTER,right:cd.RIGHT_CENTER,top:cd.TOP_CENTER,bottom:cd.BOTTOM_CENTER,"left-top":cd.TOP_LEFT,"top-left":cd.TOP_LEFT,"left-center":cd.LEFT_CENTER,"center-left":cd.LEFT_CENTER,"left-bottom":cd.BOTTOM_LEFT,"bottom-left":cd.BOTTOM_LEFT,"center-top":cd.TOP_CENTER,"top-center":cd.TOP_CENTER,"center-center":cd.CENTER,"center-bottom":cd.BOTTOM_CENTER,"bottom-center":cd.BOTTOM_CENTER,"right-top":cd.TOP_RIGHT,"top-right":cd.TOP_RIGHT,"right-center":cd.RIGHT_CENTER,"center-right":cd.RIGHT_CENTER,"right-bottom":cd.BOTTOM_RIGHT,"bottom-right":cd.BOTTOM_RIGHT},pd=function(){},gd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:pd,events:{once:pd}}},0,0,1,1);gd.setOrigin(0);var fd=0,vd=1,md=2,yd=4,bd=6,xd=8,kd=10,Cd=12,Sd=function(t){var e=Nr(t);return t.y+e-e*t.originY},wd=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Td=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Pd=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Od=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=zr(t);return t.x+e-e*t.originX},Md=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Dd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ld=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Ad=function(t){var e=Nr(t);return t.y-e*t.originY},Rd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},Bd=[];Bd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Td(t,Sd(e)+s),t},Bd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Td(t,Sd(e)+s),t},Bd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Td(t,Sd(e)+s),t},Bd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Pd(t,e),Dd(t,i)}(t,wd(e)+i,Ld(e)+s),t},Bd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Dd(t,Ld(e)+s),t},Bd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Dd(t,Ld(e)+s),t},Bd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Rd(t,Ad(e)-s),t},Bd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Rd(t,Ad(e)-s),t},Bd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Rd(t,Ad(e)-s),t};var Fd=function(t,e,i,s,r){return Bd[i](t,e,s,r)},Id=function(t,e,i,s,r,n){gd.setPosition(e,i).setSize(s,r),Fd(t,gd,n)};const jd=Phaser.Utils.Objects.GetValue,zd=Phaser.GameObjects.Group;var Nd=function(t,e,i){return t.add.text(0,0,"")},Gd=void 0;const Wd=nl.prototype.add;var Vd=function(t){return Wd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Yd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Vd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Sl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Xd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Xd(i)):i=null);else for(i=Xd(t);i&&i.name!==e;)i=Xd(i);return i},Hd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Xd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Xd(t);e;)t=e,e=Xd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Xd(e);i;){if(i===t)return!0;i=Xd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const $d=Phaser.Utils.Array.Remove,Ud=nl.prototype.remove,Kd=Hd.getParentSizer;var qd=function(t,e){for(var i=Kd(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Kd(i);return this.isBackground(t)&&$d(this.backgroundChildren,t),Ud.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Jd=Phaser.Utils.Array.Remove,Zd=Hd.getParentSizer;var Qd={removeFromParentSizer(){var t=Zd(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Jd(this.backgroundChildren,t),qd.call(this,t,e)),this},removeAllBackgrounds(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}},tp=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};const ep=/(\S+)\[(\d+)\]/i;const ip=Phaser.Utils.Objects.GetValue;var sp=function(t,e){return void 0===e?t:t[e]},rp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ip(e,"left",0),t.right=ip(e,"right",0),t.top=ip(e,"top",0),t.bottom=ip(e,"bottom",0)),t},np={getInnerPadding(t){return sp(this.space,t)},setInnerPadding(t,e){return rp(this.space,t,e),this},getOuterPadding(t){return sp(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return rp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),rp(this.getSizerConfig(t).padding,e,i),this}},ap=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},op=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},hp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},lp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},up=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},cp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},dp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},pp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var xg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Rn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},kg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=pd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=pd),this.transitOutCallback=t,this}},Cg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Sg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},wg={};Object.assign(wg,xg,kg,Cg,Sg);const Tg=Phaser.Utils.Objects.GetValue;class Pg extends zn{constructor(t,e){super(t,e),this.setTransitInTime(Tg(e,"duration.in",200)),this.setTransitOutTime(Tg(e,"duration.out",200)),this.setTransitInCallback(Tg(e,"transitIn")),this.setTransitOutCallback(Tg(e,"transitOut")),this.oneShotMode=Tg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new bg(this,{eventEmitter:!1,initState:Tg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Pg.prototype,wg);const _g=Phaser.GameObjects.Rectangle;class Og extends _g{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Eg=Phaser.Utils.Objects.GetValue;class Mg extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Eg(t,"hitAreaMode",0)),this.setEnable(Eg(t,"enable",!0)),this.setStopMode(Eg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Dg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Dg={default:0,fullWindow:1};const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Og{constructor(t,e){super(t,Lg(e,"color",0),Lg(e,"alpha",.8)),this.touchEventStop=new Mg(this,{hitAreaMode:1})}}var Rg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Op(t,e)},scaleDown(t,e){Ep(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e)},fadeOut(t,e){Wp(t,e,!1)}},Bg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e,t.alpha)},Fg=function(t,e){Wp(t,e,!1)},Ig=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const jg=Phaser.Utils.Objects.GetValue;let zg=class extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ng.popUp),null==e.transitOut&&(e.transitOut=Ng.scaleDown),e.destroy=jg(e,"destroy",!0),super(t,e);var i=jg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(jg(i,"transitIn",Bg)),this.setCoverTransitOutCallback(jg(i,"transitOut",Fg)));var s=jg(e,"touchOutsideClose",!1),r=jg(e,"duration.hold",-1),n=jg(e,"timeOutClose",r>=0),a=jg(e,"anyTouchClose",!1);jg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),jg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ig(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.popUp:t=Rg.popUp;break;case Ng.fadeIn:t=Rg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.scaleDown:t=Rg.scaleDown;break;case Ng.fadeOut:t=Rg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ng={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Gg=function(t){return t&&"function"==typeof t},Wg={modal(t,e){return Gg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new zg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Vg=function(t,e,i,s,r){Gg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Yg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),yo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Vg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Vg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Vg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Vg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Vg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Vg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Vg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Vg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Vg.call(this,"shutdown",t,e,i,s),this}},Xg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Hg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Hg={},$g=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ig(t,e.x,e.y,i,s):!!(r=Xg(e,n,!0))&&Ig(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const af={press:0,pointerdown:0,release:1,pointerup:1};var of={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new nf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},hf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!lf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return uf.length=0,!0;return uf.length=0,!1},uf=[];const cf=Phaser.Utils.Objects.GetValue;class df extends zn{constructor(t,e){super(t,e),this._enable=void 0;var i=cf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(cf(t,"enable",!0)),this.setMode(cf(t,"mode",1)),this.setClickInterval(cf(t,"clickInterval",100)),this.setDragThreshold(cf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=pf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?hf:$g)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const pf={press:0,pointerdown:0,release:1,pointerup:1};var gf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new df(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ff extends yg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const vf=Phaser.Utils.Objects.GetValue;class mf extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ff,this.parent.setInteractive(vf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(vf(t,"enable",!0)),this.setCooldown(vf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var yf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&$g(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new mf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new mf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},bf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},xf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ff,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===If&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=jf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&$g(t,s,e,i)}}const Ff=0,If=1,jf="IDLE",zf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Math.Distance.Between;class Gf extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wf},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(zf(t,"time",250)),this.setTapInterval(zf(t,"tapInterval",200)),this.setDragThreshold(zf(t,"threshold",9)),this.setTapOffset(zf(t,"tapOffset",10));var e=zf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(zf(t,"maxTaps",void 0)),this.setMinTaps(zf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Wf:this.state=Vf;break;case Vf:var t=this.lastPointer;Nf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yf,this.state=Vf);break;case Yf:this.state=Vf}}onDragEnd(){this.state===Vf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Yf))}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Vf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Wf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yf:this.state=Wf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Yf&&(this.state=Wf)}get isTapped(){return this.state===Yf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Wf="IDLE",Vf="BEGIN",Yf="RECOGNIZED",Xf=Phaser.Utils.Objects.GetValue;class Hf extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=$f},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xf(t,"threshold",9)),this.setHoldTime(Xf(t,"time",251)),this}onDragStart(){this.state=Uf,0===this.holdTime&&(this.state=Kf)}onDragEnd(){this.state=$f}onDrag(){this.state!==$f&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$f)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Uf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Kf))}get isPressed(){return this.state===Kf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const $f="IDLE",Uf="BEGIN",Kf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return In(t).loop.delta};const Jf=Phaser.Math.Distance.Between,Zf=Phaser.Math.Angle.Between;var Qf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Zf(e.x,e.y,t.x,t.y)}},tv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ev={};const iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.RadToDeg;class rv extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=nv},eventEmitter:!1};this.setRecongizedStateObject(new yg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(iv(t,"threshold",10)),this.setVelocityThreshold(iv(t,"velocityThreshold",1e3)),this.setDirectionMode(iv(t,"dir","8dir")),this}onDragStart(){this.state=av}onDragEnd(){this.state=nv}onDrag(){this.state===av&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ov))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ov&&(this.state=nv)}get isSwiped(){return this.state===ov}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=tv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ev),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(sv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(rv.prototype,Qf);const nv="IDLE",av="BEGIN",ov="RECOGNIZED",hv=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Array.SpliceOne,uv=Phaser.Math.Distance.Between,cv=Phaser.Math.Angle.Between;class dv{constructor(t,e){var i=Rn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(hv(e,"inputConfig",void 0)),this.setEventEmitter(hv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(hv(t,"enable",!0)),this.bounds=hv(t,"bounds",void 0),this.tracerState=gv,this.pointers.length=0,uo(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,uo(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case gv:this.tracerState=fv,this.onDrag1Start();break;case fv:this.tracerState=vv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],lv(this.pointers,e),this.tracerState){case fv:this.tracerState=gv,this.onDrag1End();break;case vv:this.tracerState=fv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case fv:this.onDrag1();break;case vv:this.onDrag2()}}}dragCancel(){return this.tracerState===vv&&this.onDrag2End(),this.pointers.length=0,uo(this.movedState),this.tracerState=gv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return cv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;pv.x=e.x-i.x,pv.y=e.y-i.y}else pv.x=0,pv.y=0;return pv}get centerX(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==vv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==vv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=mv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&$g(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&$g(t,s,e,i)}}Object.assign(dv.prototype,ur);var pv={};const gv=0,fv=1,vv=2,mv="IDLE";Phaser.Utils.Objects.GetValue;const yv=Phaser.Math.RotateAround;var bv=function(t,e,i,s){return yv(t,e,i,s),t.rotation+=s,t},xv={};const kv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,Sv=Phaser.Math.Angle.ShortestBetween,wv=Phaser.Math.RadToDeg,Tv=Phaser.Math.DegToRad;var Pv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=xv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.state=Ev}break;case Ev:t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ev}get rotation(){return Tv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Pv);const _v="IDLE",Ov="BEGIN",Ev="RECOGNIZED",Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Gf(this,e),this._tap.on("tap",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Lv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Hf(this,e),this._press.on("pressstart",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Rv=Phaser.Utils.Objects.GetValue;var Bv=function(t){var e=Rv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new rv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Iv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},Sf.call(t,e),Pf.call(t,e),Ef.call(t,e),Af.call(t,e),Dv.call(t,e),Av.call(t,e),Bv.call(t,e),t},jv={getSizerConfig:function(t){return void 0===t&&(t=this),ud(t)},getChildPrevState:function(t){var e=ud(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ln(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=jd(e,"color"),s=jd(e,"lineWidth");var h=jd(e,"name",!1);h&&(r=jd(h,"createTextCallback",Nd),n=jd(h,"createTextCallbackScope",void 0),"string"==typeof(a=jd(h,"align","left-top"))&&(a=dd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new zd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var u,c,d=this.getAllShownChildren([this]),p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const $v=Phaser.Utils.Objects.IsPlainObject,Uv=Phaser.Utils.Objects.GetValue,Kv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Jv=function(t,e,i,s,r,n,a,o,h,l){Vd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=qv[e];else if($v(e)){var d;e=Uv(d=e,"proportion",void 0),i=Uv(d,"align",Kv),s=Uv(d,"padding",0),r=Uv(d,"expand",!1),n=Uv(d,"key",void 0),a=Uv(d,"index",void 0),t.isRexSizer||(o=Uv(d,"minWidth",void 0),h=Uv(d,"minHeight",void 0)),l=Uv(d,"fitRatio",0)}return"string"==typeof i&&(i=dd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=Kv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=Sl(s),d.expand=r,d.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Zv={add:Jv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Jv.call(this,new Xv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return $v(i)&&(i.index=t),Jv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Hv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Qv=nl.prototype.clear;var tm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tm.call(this,t),this}},sm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=dd[e]),this.getSizerConfig(t).align=e,this}},rm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},nm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},am={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},om={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(vp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,pp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=lp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||op.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Vv.call(this,t,void 0),hp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||up.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Vv.call(this,void 0,t),cp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(om,Zv,im,sm,rm,nm,am);var hm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},lm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},um=function(t){return"string"==typeof t&&(t=lm[t]),t};const cm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue;class pm extends Nv{constructor(t,e,i,s,r,n,a){cm(e)?(e=dm(a=e,"x",0),i=dm(a,"y",0),s=dm(a,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(s)?(s=dm(a=s,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(n)&&(n=dm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(dm(a,"space.item",0)),this.setStartChildIndex(dm(a,"startChildIndex",0)),this.setRTL(dm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=um(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=hm.call(this)),this._childrenProportion}}Object.assign(pm.prototype,om);var gm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},fm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},vm={appendText:fm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class mm extends pm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(gm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(gm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&gm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&gm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(mm.prototype,vm);var ym=function(t,e,i,s){var r=new Pl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const bm=Phaser.Utils.Objects.GetValue;const xm=Phaser.Utils.Objects.GetValue;var km=/^[\x00-\x7F]+$/,Cm=function(t){return km.test(t)},Sm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Tm=0,Pm=1,_m=2,Om=0,Em=1,Mm=2,Dm=/(?:\r\n|\r|\n)/;const Lm={none:Om,word:Em,char:Mm,character:Mm,mix:3};var Am=function(t,e){switch(Gc(t)){case 0:switch("string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Sm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e}};const Rm=Phaser.Renderer.WebGL.Utils;var Bm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Rm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Fm=Phaser.Display.Color;var Im={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Fm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},jm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},zm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,jm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};eh();const Nm=Phaser.Display.Canvas.CanvasPool,Gm=Phaser.GameObjects.GameObject,Wm=Phaser.Utils.String.UUID;let Vm=class extends Gm{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Nm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Wm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Nm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Ym=Phaser.GameObjects.Components;Phaser.Class.mixin(Vm,[Ym.Alpha,Ym.BlendMode,Ym.Crop,Ym.Depth,Ym.Flip,Ym.GetBounds,Ym.Mask,Ym.Origin,Ym.Pipeline,Ym.PostPipeline,Ym.ScrollFactor,Ym.Tint,Ym.Transform,Ym.Visible,Bm,Im,zm]);let Xm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Xm.prototype,Zl);var Hm={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const $m=Phaser.Math.RotateAround;var Um;const Km=Phaser.Geom.Rectangle;var qm,Jm=function(t){void 0===qm&&(qm=new Km);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Zm=Phaser.Math.RotateAround;var Qm,ty=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Qm&&(Qm={}),s=Qm),s.x=e,s.y=i,0!==t.rotation&&Zm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ey=Phaser.GameObjects.Components.TransformMatrix;var iy,sy,ry={},ny=function(t,e,i,s,r){var n=ty(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ry);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===iy&&(iy=new ey,sy=new ey),t.parentContainer?t.getWorldTransformMatrix(iy,sy):iy.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),iy.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ay=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ny(t,e,n,a,r)},oy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Um&&(Um={}),s=Um),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&$m(s,0,0,-i.rotation),s}(t,e,this,!0);return Jm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ay(this.parent,this,t,e,i)}};Object.assign(oy,Hm);const hy=Phaser.Math.DegToRad,ly=Phaser.Math.RadToDeg,uy=Phaser.Utils.Objects.GetValue;class cy extends Xm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ly(this._rotation)}set angle(t){this.rotation=hy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=uy(t,"width",void 0),i=uy(t,"height",void 0),s=uy(t,"scaleX",void 0),r=uy(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(cy.prototype,oy);const dy=Phaser.Utils.String.Pad;var py=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${dy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},gy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const fy=Phaser.Utils.Objects.GetValue;let vy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=fy(t,"x",0),i=fy(t,"y",0));var s=this.cornerRadius;s.tl=my(fy(t,"tl",void 0),e,i),s.tr=my(fy(t,"tr",void 0),e,i),s.bl=my(fy(t,"bl",void 0),e,i),s.br=my(fy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){yy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){yy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){yy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){yy(this.cornerRadius.br,t)}};var my=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),by(t),t},yy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=fy(e,"x",0),t.y=fy(e,"y",0)),by(t)},by=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const xy=Phaser.Math.DegToRad;var ky=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},Sy=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,l,h,l,180,270,!1,a):Sy(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,l,h,l,270,360,!1,a):Sy(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,r-l,h,l,0,90,!1,a):Sy(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,r-l,h,l,90,180,!1,a):Sy(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Ty=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),wy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Py=Phaser.Utils.Objects.GetValue;class _y extends cy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Py(e,"color",null),Py(e,"color2",null),Py(e,"horizontalGradient",!0)),this.setStroke(Py(e,"stroke",null),Py(e,"strokeThickness",2)),this.setCornerRadius(Py(e,"cornerRadius",0),Py(e,"cornerIteration",null))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=py(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,gy("color2",t,this),gy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,gy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,gy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ty(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Oy=Phaser.Utils.Objects.GetValue;class Ey extends cy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Oy(e,"color",null),Oy(e,"color2",null),Oy(e,"horizontalGradient",!0)),this.setStroke(Oy(e,"stroke",null),Oy(e,"strokeThickness",2))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=py(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Oy(t,"color2",null),Oy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const My=Phaser.Utils.Objects.GetValue;let Dy=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(My(t,"bold",!1)),this.setItalic(My(t,"italic",!1)),this.setFontSize(My(t,"fontSize","16px")),this.setFontFamily(My(t,"fontFamily","Courier")),this.setColor(My(t,"color","#fff")),this.setStrokeStyle(My(t,"stroke",null),My(t,"strokeThickness",0)),this.setShadow(My(t,"shadowColor",null),My(t,"shadowOffsetX",0),My(t,"shadowOffsetY",0),My(t,"shadowBlur",0)),this.setOffset(My(t,"offsetX",0),My(t,"offsetY",0)),this.setSpace(My(t,"leftSpace",0),My(t,"rightSpace",0)),this.setAlign(My(t,"align",void 0)),this.setBackgroundColor(My(t,"backgroundColor",null)),this.setBackgroundHeight(My(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(My(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(gy("stroke",t,this),gy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(gy("shadowOffsetX",t,this),gy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=py(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=py(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=py(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=py(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ly=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ry="text",By="image",Fy="drawer",Iy="space",jy="command";var zy=function(t){return t.type===Ry&&"\n"===t.text},Ny=function(t){return t.type===Ry&&"\f"===t.text},Gy=function(t){return t.type===Ry};class Wy extends cy{constructor(t,e,i){super(t,Ry),this.updateTextFlag=!1,this.style=new Dy(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Vy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yy=Phaser.Display.Canvas.CanvasPool;var Xy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Yy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Hy extends cy{constructor(t,e,i){super(t,By),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Xy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class $y extends cy{constructor(t,e,i,s){super(t,Fy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Uy extends cy{constructor(t,e){super(t,Iy),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ky extends Xm{constructor(t,e,i,s,r){super(t,jy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Jy={none:0,word:1,char:2,character:2,mix:3};var Zy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=ib.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=ib.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=rb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=rb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=rb(t,"wrapMode");void 0===c&&(c=rb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Jy[c]);var d=rb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=rb(t,"letterSpacing",0),g=rb(t,"hAlign",0),f=rb(t,"vAlign",0),v=rb(t,"justifyPercentage",.25),m=qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=O.length,m.isLastPage=!A&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ob(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ob(t,"maxLines",0);var o=0===i,h=ob(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ob(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ob(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ob(t,"letterSpacing",0),p=ob(t,"rtl",!0),g=ob(t,"hAlign",p?2:0),f=ob(t,"vAlign",0),v=qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:E,height:M}),D=Math.max(D,M)),v.start+=_.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return rp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return sp(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ly(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ay(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ry);return null===i?i=new Wy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ay(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Gb(t,r,e,i,n),o=0;o<=jb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Gb(t,r,e,i,n)}return o===jb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wb(t,e,i),t},Nb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Gb=function(t,e,i,s,r){var n,a=Nb(t,e,r),o=Nb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Wb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Vb=Phaser.Utils.Objects.GetValue;var Yb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Vb(e,"minWidth",0),s=Vb(e,"minHeight",0),r=Vb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return zb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),zb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xb=Phaser.Utils.Objects.GetValue,Hb=[function(t){var e=this.scene,i=bm(t,"orientation",0);this.setOrientation(i);var s=bm(t,"icon",void 0),r=bm(t,"iconMask",void 0),n=bm(t,"innerBackground",void 0),a=bm(t,"title",void 0),o=bm(t,"separator",void 0),h=bm(t,"text",void 0),l=bm(t,"action",void 0),u=bm(t,"actionMask",void 0);if(s){var c=bm(t,"align.icon","center");m=0===this.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var d=bm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=ym.call(this,s,s,1)),!d){var p=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",p),bm(t,"iconHeight",p))}}var g=new pm(e,{orientation:1});n&&g.addBackground(n);var f=bm(t,"space.separator",0);if(a){c=bm(t,"align.title","left");var v=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?bm(t,"space.title",f):0,left:bm(t,"space.titleLeft",0),right:bm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=bm(t,"align.text","left");var y,b,x=bm(t,"expandTextWidth",!1);y=bm(t,"expandTextHeight",!1)?1:0,b=x,m={left:bm(t,"space.textLeft",0),right:bm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:bm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=bm(t,"align.action","center");m=0===this.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};d=bm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=ym.call(this,l,l,1)),!d){var k=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",k),bm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=xm(t,"title",void 0),s=xm(t,"separator",void 0),r=xm(t,"innerBackground",void 0),n=xm(t,"icon",void 0),a=xm(t,"iconMask",void 0),o=xm(t,"text",void 0),h=xm(t,"action",void 0),l=xm(t,"actionMask",void 0);if(i){var u=xm(t,"align.title","left"),c=xm(t,"expandTitleWidth",!1);y=xm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:xm(t,"space.title",0),left:xm(t,"space.titleLeft",0),right:xm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=xm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:xm(t,"space.separatorLeft",0),right:xm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=xm(t,"orientation",0),f=new pm(e,{orientation:g,rtl:xm(t,"rtl",!1),space:{left:xm(t,"space.innerLeft",0),right:xm(t,"space.innerRight",0),top:xm(t,"space.innerTop",0),bottom:xm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=xm(t,"align.icon","center");p=0===f.orientation?{right:xm(t,"space.icon",0),top:xm(t,"space.iconTop",0),bottom:xm(t,"space.iconBottom",0),left:xm(t,"space.iconLeft",0)}:{bottom:xm(t,"space.icon",0),left:xm(t,"space.iconLeft",0),right:xm(t,"space.iconRight",0),top:xm(t,"space.iconTop",0)};var v=xm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=ym.call(this,n,n,1)),!v){var m=xm(t,"iconSize",void 0);this.setIconSize(xm(t,"iconWidth",m),xm(t,"iconHeight",m))}}if(o){u=xm(t,"align.text","left");var y,b,x=xm(t,"space.text",0),k=xm(t,"expandTextWidth",!1),C=xm(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=xm(t,"align.action","center");p=0===f.orientation?{top:xm(t,"space.actionTop",0),bottom:xm(t,"space.actionBottom",0),right:xm(t,"space.actionRight",0)}:{left:xm(t,"space.actionLeft",0),right:xm(t,"space.actionRight",0),bottom:xm(t,"space.actionBottom",0)};v=xm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=ym.call(this,h,h,1)),!v){var S=xm(t,"actionSize");this.setActionSize(xm(t,"actionWidth",S),xm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class $b extends mm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Xb(e,"background",void 0);i&&this.addBackground(i);var s=Xb(e,"title",void 0),r=Xb(e,"text",void 0);if(s){var n=Xb(e,"wrapTitle",!1),a=Xb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Ib(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(s,{fitHeight:!0}))}if(r){var o=Xb(e,"wrapText",!1),h=Xb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Ib(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(r,{fitHeight:!0}))}var l=Xb(e,"layoutMode",0);(Hb[l]||Hb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Ub extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=hd(i,"expandTextWidth",!1),n=hd(i,"expandTextHeight",!1);if(r||n){var a=Gc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(hd(i,"typingMode","page")),this.page=new Jc(s,hd(i,"page",void 0)),this.typing=new ad(s,hd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ld[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}($b)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Kb=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Jb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&eu(r,a,e,l,o,h),e.isStroked&&su(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Qb.prototype,Jb);var tx=function(t){return t.x>0&&t.y>0};const ex=Phaser.Utils.Objects.IsPlainObject,ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Geom.Polygon.Earcut;class rx extends Qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(ex(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new vy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ix(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(ix(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,tx(i))if(i.convex){var o=i.x,h=i.y;uu(o,h,i.x,i.y,180,270,!1,a,e)}else{uu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else hu(0,0,e);if(i=n.tr,tx(i))if(i.convex){o=s-i.x,h=i.y;uu(o,h,i.x,i.y,270,360,!1,a,e)}else{uu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else hu(s,0,e);if(i=n.br,tx(i))if(i.convex){o=s-i.x,h=r-i.y;uu(o,h,i.x,i.y,0,90,!1,a,e)}else{uu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else hu(s,r,e);if(i=n.bl,tx(i))if(i.convex){o=i.x,h=r-i.y;uu(o,h,i.x,i.y,90,180,!1,a,e)}else{uu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else hu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=sx(e),this}setShapeType(t){return"string"==typeof t&&(t=nx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const nx={rectangle:0,circle:1};var ax=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ox=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const vx=Phaser.Utils.Objects.GetValue,mx=Phaser.Utils.Objects.IsPlainObject;class yx extends(oc(ql)){constructor(t,e,i,s,r,n,a,o){mx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):mx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):mx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Fu).setName("trackFill")).addShape((new Fu).setName("bar")).addShape((new Fu).setName("trackStroke")),this.setTrackColor(vx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vx(o,"trackStrokeThickness",2),vx(o,"trackStrokeColor",void 0)),this.setSkewX(vx(o,"skewX",0)),this.setRTL(vx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var bx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&fx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),fx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&fx(o,0,0,e,i,t)}};Object.assign(yx.prototype,bx);class xx extends yx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=kx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const kx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(xx.prototype,dx);let Cx=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Sx=Phaser.GameObjects.NineSlice,wx=Phaser.Utils.Objects.GetValue;class Tx extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",null),wx(e,"frame",null),wx(e,"width",0),wx(e,"height",0),wx(e,"leftWidth",0),wx(e,"rightWidth",0),wx(e,"topHeight",0),wx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=wx(e,"effects",!0);i&&Mr(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Tx.prototype,dx);let Px=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const _x=Phaser.GameObjects.Image,Ox=Phaser.Utils.Objects.GetValue;class Ex extends _x{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",""),Ox(e,"frame",void 0)),this.type="rexStatesImage";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Px(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ex.prototype,dx);var Mx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Dx=Phaser.Utils.Objects.IsPlainObject,Lx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Rx[t]),t};const Rx={scale:0,repeat:1};var Bx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:pd,_drawImage:pd,_drawTileSprite:pd,_endDraw:pd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Mx),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Dx(t)?(this.stretchMode.edge=Ax(Lx(t,"edge",0)),this.stretchMode.internal=Ax(Lx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ix=Phaser.Utils.Objects.IsPlainObject,jx=Phaser.Utils.Objects.GetValue;const zx=Phaser.GameObjects;var Nx=void 0,Gx=function(t,e){if(Nx||(Nx={},In(t).events.once("destroy",(function(){for(var t in Nx)Nx[t].destroy();Nx=void 0}))),!Nx.hasOwnProperty(e)){var i=In(t).scene.systemScene;(t=new zx[e](i)).setOrigin(0),Nx[e]=t}return Nx[e]};const Wx=Phaser.GameObjects.RenderTexture;class Vx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Ix(i)?(i=jx(u=i,"x",0),s=jx(u,"y",0),r=jx(u,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(r)?(r=jx(u=r,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(a)?(a=jx(u=a,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(o)?(o=jx(u=o,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=jx(u,"baseFrame",void 0)):Ix(h)&&(h=jx(u=h,"columns",void 0),l=jx(u,"rows",void 0)),void 0===o&&(o=jx(u,"frame",void 0)),void 0===h){var c=jx(u,"leftWidth",void 0),d=jx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=jx(u,"topHeight",void 0),g=jx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(jx(u,"getFrameNameCallback",void 0)),this.setStretchMode(jx(u,"stretchMode",0)),this.setPreserveRatio(jx(u,"preserveRatio",!0));var f=jx(u,"maxFixedPartScale",1),v=jx(u,"maxFixedPartScaleX",f),m=jx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Fx),i}(Wx,"rexNinePatch")){}var Yx={_drawImage:function(t,e,i,s,r,n){var a=Gx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Gx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vx.prototype,Yx);let Xx=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Hx=Phaser.Utils.Objects.GetValue;class $x extends Vx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Hx(e,"effects",!0);i&&Mr(this,i),this.style=new Xx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign($x.prototype,dx);const Ux=["alpha","tint","flipX","flipY"];var Kx=function(t,e){if(!e)return t;for(var i=0,s=Ux.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround;var Yr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Xr&&(Xr=new Gr),e=Xr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Hr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Ur(t,e),a=e.x,o=e.y,Kr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Xr=void 0,Hr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},qr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zr(t,e,i)},Jr=void 0,Zr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Qr=Phaser.Utils.Objects.GetValue;var tn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qr(i,"color"),r=Qr(i,"lineWidth"),n=Qr(i,"fillColor"),a=Qr(i,"fillAlpha",1),o=Qr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Jn:qn,this.repeatCounter=0,this}stop(){return this.state=Kn,this}update(t,e){this.state!==Kn&&this.state!==Qn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Zn)):(this.nowTime=this.duration,this.state=Qn):this.nowTime>=0&&(this.state=Jn))}get t(){var t;switch(this.state){case Kn:case qn:case Zn:t=0;break;case Jn:t=this.nowTime/this.duration;break;case Qn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=qn,this.nowTime=-this.delay*t):(this.state=Jn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Kn}get isDelay(){return this.state===qn}get isCountDown(){return this.state===Jn}get isRunning(){return this.state===qn||this.state===Jn}get isDone(){return this.state===Qn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Kn=0,qn=1,Jn=2,Zn=3,Qn=-1;class ta extends Yn{constructor(t,e){super(t,e),this.timer=new Un}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ea=Phaser.Utils.Objects.GetValue,ia=Phaser.Utils.Objects.GetAdvancedValue,sa=Phaser.Tweens.Builders.GetEaseFunction;class ra extends ta{resetFromJSON(t){return this.timer.resetFromJSON(ea(t,"timer")),this.setEnable(ea(t,"enable",!0)),this.setTarget(ea(t,"target",this.parent)),this.setDelay(ia(t,"delay",0)),this.setDuration(ia(t,"duration",1e3)),this.setEase(ea(t,"ease","Linear")),this.setRepeat(ea(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=sa(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const na=Phaser.Sound.BaseSound;var aa=function(t){return t instanceof na};const oa=Phaser.Utils.Objects.GetValue,ha=Phaser.Utils.Objects.GetAdvancedValue,la=Phaser.Math.Linear;let ua=class extends ra{constructor(t,e,i){aa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(oa(t,"mode",0)),this.setEnable(oa(t,"enable",!0)),this.setVolumeRange(ha(t,"volume.start",this.parent.volume),ha(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ca[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=la(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ca={stop:1,destroy:2};var da=function(t,e,i,s,r){aa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ua(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},pa=function(t,e,i,s){aa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ua(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusicMute),volume:ga(e,"volume",this.backgroundMusicVolume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&da(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&pa(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const va=Phaser.Utils.Objects.GetValue;var ma={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:va(e,"loop",this.backgroundMusicLoop),mute:va(e,"mute",this.backgroundMusic2Mute),volume:va(e,"volume",this.backgroundMusic2Volume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&da(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ya=Phaser.Utils.Array.Remove,ba=Phaser.Utils.Objects.GetValue;var xa={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ba(e,"mute",this.soundEffectsMute),volume:ba(e,"volume",this.soundEffectsVolume),detune:ba(e,"detune",0),rate:ba(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ya(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ya(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&da(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&pa(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)pa(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&da(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&pa(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)pa(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ra=Phaser.Utils.Objects.GetValue,Ba=new class extends Aa{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=eo(this.delimiterLeft),e=eo(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=no),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ho),this.tagExpression=t,this}setValueExpression(t){return t||(t=ho),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ho||this.valueExpression!==ho){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=eo(this.delimiterLeft),e=eo(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ao(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ho="[^=]+";var lo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],uo=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},co=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:uo(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},Co={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},So={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},wo={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},To={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Po=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Po(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Po(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Oo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Ho=Phaser.GameObjects.Zone;let $o=class extends Ho{constructor(t){super(t,0,0,2,2),this.fullWindow=new Xo(this)}};const Uo="BG",Ko="SPRITE",qo="TEXTBOX",Jo="TITLE",Zo="CHOICE",Qo="NAMEINPUT";var th=!1,eh=function(t){th||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return sh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return rh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iuh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;euh(t).x,getChildLocalY:t=>uh(t).y};const Ph=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=uh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=uh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return uh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return uh(t).rotation=Ph(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=uh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>uh(t).rotation},Oh={updateChildScale(t){var e=uh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=uh(t),i=e.parent;return e.scaleX=wh(t.scaleX,i.scaleX),e.scaleY=wh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=uh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=uh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>uh(t).scaleX,getChildLocalScaleY:t=>uh(t).scaleY},Eh={updateChildVisible(t){var e=uh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=uh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),uh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),uh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=uh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>uh(t).visible},Mh={updateChildAlpha(t){var e=uh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=uh(t),i=e.parent;return e.alpha=wh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return uh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=uh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>uh(t).alpha},Dh={updateChildActive(t){var e=uh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return uh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),uh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=uh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>uh(t).active},Lh={updateChildScrollFactor(t){var e=uh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ah={updateCameraFilter(t){var e=uh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Rh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Bh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Fh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Ih=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const zh=Phaser.Utils.Array;var Nh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,_):r(c,d,_),h&&c.add.existing(P),l){var O=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(O,E).setScale(f,v).setRotation(m),Ll(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Wl.prototype,Bl);const Yl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Xl=Phaser.GameObjects.GetCalcMatrix;const Hl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Xl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},nu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const au=Phaser.Geom.Polygon.Earcut;class ou extends Ql{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=au(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&eu(t,e,this,i,s,r),this.isStroked&&su(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const lu=Phaser.Math.DegToRad;var uu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=ju(t,"tl",0),this.radiusTR=ju(t,"tr",0),this.radiusBL=ju(t,"bl",0),this.radiusBR=ju(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?uu(e,e,e,e,180,270,!1,r,t):uu(0,0,e,e,90,0,!0,r,t):hu(0,0,t);(e=this.radiusTR)>0?this._convexTR?uu(i-e,e,e,e,270,360,!1,r,t):uu(i,0,e,e,180,90,!0,r,t):hu(i,0,t);(e=this.radiusBR)>0?this._convexBR?uu(i-e,s-e,e,e,0,90,!1,r,t):uu(i,s,e,e,270,180,!0,r,t):hu(i,s,t);(e=this.radiusBL)>0?this._convexBL?uu(e,s-e,e,e,90,180,!1,r,t):uu(0,s,e,e,360,270,!0,r,t):hu(0,s,t);return t.push(t[0],t[1]),xu(this.x,this.y,t),super.updateData(),this}};const Nu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Gu={arc:du,circle:pu,curve:class extends ou{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),vc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,gc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class bc extends Wl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=yc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Vc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Yc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Vc(t));t=this.sections.join("\n");this.lines=Wc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Kc,Yc,Hc,Uc);const qc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Jc extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Gc(this.parent),this.pageStartIndexes=[],this.lines=Wc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(qc(t,"maxLines",void 0)),this.setPageBreak(qc(t,"pageBreak","\f\n")),this.setText(qc(t,"text","")),this.startLineIndex=qc(t,"start",-1),this.endLineIndex=qc(t,"end",void 0);var e=qc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Gc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Jc.prototype,Kc);var Zc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$c(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Vc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Qc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},td=function(t,e){for(var i=void 0,s=0;s0)l=ed(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=ed(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},sd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=Qc(this.parent,t);n=td(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(sd,Zc);const rd=Phaser.Utils.Objects.GetFastValue,nd=Phaser.Utils.Objects.GetValue;class ad extends zn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(nd(t,"wrap",!1)),this.setTypeMode(nd(t,"typeMode",0)),this.setTypingSpeed(nd(t,"speed",333)),this.setTextCallback=rd(t,"setTextCallback",null),this.setTextCallbackScope=rd(t,"setTextCallbackScope",null),this.setTypingContent(rd(t,"text","")),this.typingIndex=rd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=rd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=od[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Vc(t);this.textWrapEnable&&(e=function(t,e){switch(Gc(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=Qc(this.parent,this.text).length,this}onTyping(){var t=id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$c(this.parent,t):this.parent.setText(t)}}const od={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(ad.prototype,sd);const hd=Phaser.Utils.Objects.GetValue;const ld={page:0,line:1};var ud=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const cd=Phaser.Display.Align;var dd={center:cd.CENTER,left:cd.LEFT_CENTER,right:cd.RIGHT_CENTER,top:cd.TOP_CENTER,bottom:cd.BOTTOM_CENTER,"left-top":cd.TOP_LEFT,"top-left":cd.TOP_LEFT,"left-center":cd.LEFT_CENTER,"center-left":cd.LEFT_CENTER,"left-bottom":cd.BOTTOM_LEFT,"bottom-left":cd.BOTTOM_LEFT,"center-top":cd.TOP_CENTER,"top-center":cd.TOP_CENTER,"center-center":cd.CENTER,"center-bottom":cd.BOTTOM_CENTER,"bottom-center":cd.BOTTOM_CENTER,"right-top":cd.TOP_RIGHT,"top-right":cd.TOP_RIGHT,"right-center":cd.RIGHT_CENTER,"center-right":cd.RIGHT_CENTER,"right-bottom":cd.BOTTOM_RIGHT,"bottom-right":cd.BOTTOM_RIGHT},pd=function(){},gd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:pd,events:{once:pd}}},0,0,1,1);gd.setOrigin(0);var fd=0,vd=1,md=2,yd=4,bd=6,xd=8,kd=10,Cd=12,Sd=function(t){var e=Nr(t);return t.y+e-e*t.originY},wd=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Td=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Pd=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Od=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=zr(t);return t.x+e-e*t.originX},Md=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Dd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ld=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Ad=function(t){var e=Nr(t);return t.y-e*t.originY},Rd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},Bd=[];Bd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Td(t,Sd(e)+s),t},Bd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Td(t,Sd(e)+s),t},Bd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Td(t,Sd(e)+s),t},Bd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Pd(t,e),Dd(t,i)}(t,wd(e)+i,Ld(e)+s),t},Bd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Dd(t,Ld(e)+s),t},Bd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Dd(t,Ld(e)+s),t},Bd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Rd(t,Ad(e)-s),t},Bd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Rd(t,Ad(e)-s),t},Bd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Rd(t,Ad(e)-s),t};var Fd=function(t,e,i,s,r){return Bd[i](t,e,s,r)},Id=function(t,e,i,s,r,n){gd.setPosition(e,i).setSize(s,r),Fd(t,gd,n)};const jd=Phaser.Utils.Objects.GetValue,zd=Phaser.GameObjects.Group;var Nd=function(t,e,i){return t.add.text(0,0,"")},Gd=void 0;const Wd=nl.prototype.add;var Vd=function(t){return Wd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Yd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Vd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Sl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Xd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Xd(i)):i=null);else for(i=Xd(t);i&&i.name!==e;)i=Xd(i);return i},Hd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Xd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Xd(t);e;)t=e,e=Xd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Xd(e);i;){if(i===t)return!0;i=Xd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const $d=Phaser.Utils.Array.Remove,Ud=nl.prototype.remove,Kd=Hd.getParentSizer;var qd=function(t,e){for(var i=Kd(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Kd(i);return this.isBackground(t)&&$d(this.backgroundChildren,t),Ud.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Jd=Phaser.Utils.Array.Remove,Zd=Hd.getParentSizer;var Qd={removeFromParentSizer(){var t=Zd(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Jd(this.backgroundChildren,t),qd.call(this,t,e)),this},removeAllBackgrounds(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}},tp=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};const ep=/(\S+)\[(\d+)\]/i;const ip=Phaser.Utils.Objects.GetValue;var sp=function(t,e){return void 0===e?t:t[e]},rp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ip(e,"left",0),t.right=ip(e,"right",0),t.top=ip(e,"top",0),t.bottom=ip(e,"bottom",0)),t},np={getInnerPadding(t){return sp(this.space,t)},setInnerPadding(t,e){return rp(this.space,t,e),this},getOuterPadding(t){return sp(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return rp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),rp(this.getSizerConfig(t).padding,e,i),this}},ap=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},op=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},hp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},lp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},up=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},cp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},dp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},pp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var xg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Rn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},kg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=pd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=pd),this.transitOutCallback=t,this}},Cg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Sg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},wg={};Object.assign(wg,xg,kg,Cg,Sg);const Tg=Phaser.Utils.Objects.GetValue;class Pg extends zn{constructor(t,e){super(t,e),this.setTransitInTime(Tg(e,"duration.in",200)),this.setTransitOutTime(Tg(e,"duration.out",200)),this.setTransitInCallback(Tg(e,"transitIn")),this.setTransitOutCallback(Tg(e,"transitOut")),this.oneShotMode=Tg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new bg(this,{eventEmitter:!1,initState:Tg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Pg.prototype,wg);const _g=Phaser.GameObjects.Rectangle;class Og extends _g{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Eg=Phaser.Utils.Objects.GetValue;class Mg extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Eg(t,"hitAreaMode",0)),this.setEnable(Eg(t,"enable",!0)),this.setStopMode(Eg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Dg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Dg={default:0,fullWindow:1};const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Og{constructor(t,e){super(t,Lg(e,"color",0),Lg(e,"alpha",.8)),this.touchEventStop=new Mg(this,{hitAreaMode:1})}}var Rg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Op(t,e)},scaleDown(t,e){Ep(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e)},fadeOut(t,e){Wp(t,e,!1)}},Bg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e,t.alpha)},Fg=function(t,e){Wp(t,e,!1)},Ig=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const jg=Phaser.Utils.Objects.GetValue;let zg=class extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ng.popUp),null==e.transitOut&&(e.transitOut=Ng.scaleDown),e.destroy=jg(e,"destroy",!0),super(t,e);var i=jg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(jg(i,"transitIn",Bg)),this.setCoverTransitOutCallback(jg(i,"transitOut",Fg)));var s=jg(e,"touchOutsideClose",!1),r=jg(e,"duration.hold",-1),n=jg(e,"timeOutClose",r>=0),a=jg(e,"anyTouchClose",!1);jg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),jg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ig(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.popUp:t=Rg.popUp;break;case Ng.fadeIn:t=Rg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.scaleDown:t=Rg.scaleDown;break;case Ng.fadeOut:t=Rg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ng={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Gg=function(t){return t&&"function"==typeof t},Wg={modal(t,e){return Gg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new zg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Vg=function(t,e,i,s,r){Gg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Yg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),yo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Vg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Vg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Vg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Vg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Vg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Vg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Vg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Vg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Vg.call(this,"shutdown",t,e,i,s),this}},Xg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Hg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Hg={},$g=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ig(t,e.x,e.y,i,s):!!(r=Xg(e,n,!0))&&Ig(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const af={press:0,pointerdown:0,release:1,pointerup:1};var of={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new nf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},hf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!lf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return uf.length=0,!0;return uf.length=0,!1},uf=[];const cf=Phaser.Utils.Objects.GetValue;class df extends zn{constructor(t,e){super(t,e),this._enable=void 0;var i=cf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(cf(t,"enable",!0)),this.setMode(cf(t,"mode",1)),this.setClickInterval(cf(t,"clickInterval",100)),this.setDragThreshold(cf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=pf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?hf:$g)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const pf={press:0,pointerdown:0,release:1,pointerup:1};var gf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new df(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ff extends yg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const vf=Phaser.Utils.Objects.GetValue;class mf extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ff,this.parent.setInteractive(vf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(vf(t,"enable",!0)),this.setCooldown(vf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var yf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&$g(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new mf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new mf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},bf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},xf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ff,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===If&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=jf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&$g(t,s,e,i)}}const Ff=0,If=1,jf="IDLE",zf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Math.Distance.Between;class Gf extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wf},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(zf(t,"time",250)),this.setTapInterval(zf(t,"tapInterval",200)),this.setDragThreshold(zf(t,"threshold",9)),this.setTapOffset(zf(t,"tapOffset",10));var e=zf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(zf(t,"maxTaps",void 0)),this.setMinTaps(zf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Wf:this.state=Vf;break;case Vf:var t=this.lastPointer;Nf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yf,this.state=Vf);break;case Yf:this.state=Vf}}onDragEnd(){this.state===Vf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Yf))}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Vf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Wf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yf:this.state=Wf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Yf&&(this.state=Wf)}get isTapped(){return this.state===Yf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Wf="IDLE",Vf="BEGIN",Yf="RECOGNIZED",Xf=Phaser.Utils.Objects.GetValue;class Hf extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=$f},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xf(t,"threshold",9)),this.setHoldTime(Xf(t,"time",251)),this}onDragStart(){this.state=Uf,0===this.holdTime&&(this.state=Kf)}onDragEnd(){this.state=$f}onDrag(){this.state!==$f&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$f)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Uf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Kf))}get isPressed(){return this.state===Kf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const $f="IDLE",Uf="BEGIN",Kf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return In(t).loop.delta};const Jf=Phaser.Math.Distance.Between,Zf=Phaser.Math.Angle.Between;var Qf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Zf(e.x,e.y,t.x,t.y)}},tv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ev={};const iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.RadToDeg;class rv extends Bf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=nv},eventEmitter:!1};this.setRecongizedStateObject(new yg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(iv(t,"threshold",10)),this.setVelocityThreshold(iv(t,"velocityThreshold",1e3)),this.setDirectionMode(iv(t,"dir","8dir")),this}onDragStart(){this.state=av}onDragEnd(){this.state=nv}onDrag(){this.state===av&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ov))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ov&&(this.state=nv)}get isSwiped(){return this.state===ov}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=tv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ev),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(sv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(rv.prototype,Qf);const nv="IDLE",av="BEGIN",ov="RECOGNIZED",hv=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Array.SpliceOne,uv=Phaser.Math.Distance.Between,cv=Phaser.Math.Angle.Between;class dv{constructor(t,e){var i=Rn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(hv(e,"inputConfig",void 0)),this.setEventEmitter(hv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(hv(t,"enable",!0)),this.bounds=hv(t,"bounds",void 0),this.tracerState=gv,this.pointers.length=0,uo(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,uo(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case gv:this.tracerState=fv,this.onDrag1Start();break;case fv:this.tracerState=vv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],lv(this.pointers,e),this.tracerState){case fv:this.tracerState=gv,this.onDrag1End();break;case vv:this.tracerState=fv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case fv:this.onDrag1();break;case vv:this.onDrag2()}}}dragCancel(){return this.tracerState===vv&&this.onDrag2End(),this.pointers.length=0,uo(this.movedState),this.tracerState=gv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return cv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;pv.x=e.x-i.x,pv.y=e.y-i.y}else pv.x=0,pv.y=0;return pv}get centerX(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==vv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==vv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=mv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&$g(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&$g(t,s,e,i)}}Object.assign(dv.prototype,ur);var pv={};const gv=0,fv=1,vv=2,mv="IDLE";Phaser.Utils.Objects.GetValue;const yv=Phaser.Math.RotateAround;var bv=function(t,e,i,s){return yv(t,e,i,s),t.rotation+=s,t},xv={};const kv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,Sv=Phaser.Math.Angle.ShortestBetween,wv=Phaser.Math.RadToDeg,Tv=Phaser.Math.DegToRad;var Pv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=xv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.state=Ev}break;case Ev:t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ev}get rotation(){return Tv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Pv);const _v="IDLE",Ov="BEGIN",Ev="RECOGNIZED",Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Gf(this,e),this._tap.on("tap",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Lv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Hf(this,e),this._press.on("pressstart",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Rv=Phaser.Utils.Objects.GetValue;var Bv=function(t){var e=Rv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new rv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Iv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},Sf.call(t,e),Pf.call(t,e),Ef.call(t,e),Af.call(t,e),Dv.call(t,e),Av.call(t,e),Bv.call(t,e),t},jv={getSizerConfig:function(t){return void 0===t&&(t=this),ud(t)},getChildPrevState:function(t){var e=ud(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ln(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=jd(e,"color"),s=jd(e,"lineWidth");var h=jd(e,"name",!1);h&&(r=jd(h,"createTextCallback",Nd),n=jd(h,"createTextCallbackScope",void 0),"string"==typeof(a=jd(h,"align","left-top"))&&(a=dd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new zd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var u,c,d=this.getAllShownChildren([this]),p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const $v=Phaser.Utils.Objects.IsPlainObject,Uv=Phaser.Utils.Objects.GetValue,Kv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Jv=function(t,e,i,s,r,n,a,o,h,l,u,c){Vd.call(this,t);var d=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=qv[e];else if($v(e)){var g;e=Uv(g=e,"proportion",void 0),i=Uv(g,"align",Kv),s=Uv(g,"padding",0),r=Uv(g,"expand",!1),n=Uv(g,"key",void 0),a=Uv(g,"index",void 0),t.isRexSizer||(o=Uv(g,"minWidth",void 0),h=Uv(g,"minHeight",void 0)),l=Uv(g,"fitRatio",0),u=Uv(g,"offsetX",0),c=Uv(g,"offsetY",0)}return"string"==typeof i&&(i=dd[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=Kv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),void 0===u&&(u=0),void 0===c&&(c=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=Sl(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=u,g.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Zv={add:Jv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Jv.call(this,new Xv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return $v(i)&&(i.index=t),Jv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Hv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Qv=nl.prototype.clear;var tm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qv.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tm.call(this,t),this}},sm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=dd[e]),this.getSizerConfig(t).align=e,this}},rm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},nm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},am={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},om={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(vp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,pp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=lp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||op.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Vv.call(this,t,void 0),hp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||up.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Vv.call(this,void 0,t),cp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(om,Zv,im,sm,rm,nm,am);var hm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},lm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},um=function(t){return"string"==typeof t&&(t=lm[t]),t};const cm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue;class pm extends Nv{constructor(t,e,i,s,r,n,a){cm(e)?(e=dm(a=e,"x",0),i=dm(a,"y",0),s=dm(a,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(s)?(s=dm(a=s,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(n)&&(n=dm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(dm(a,"space.item",0)),this.setStartChildIndex(dm(a,"startChildIndex",0)),this.setRTL(dm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=um(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=hm.call(this)),this._childrenProportion}}Object.assign(pm.prototype,om);var gm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},fm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},vm={appendText:fm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class mm extends pm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(gm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(gm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&gm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&gm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(mm.prototype,vm);var ym=function(t,e,i,s){var r=new Pl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const bm=Phaser.Utils.Objects.GetValue;const xm=Phaser.Utils.Objects.GetValue;var km=/^[\x00-\x7F]+$/,Cm=function(t){return km.test(t)},Sm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Tm=0,Pm=1,_m=2,Om=0,Em=1,Mm=2,Dm=/(?:\r\n|\r|\n)/;const Lm={none:Om,word:Em,char:Mm,character:Mm,mix:3};var Am=function(t,e){switch(Gc(t)){case 0:switch("string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Sm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e}};const Rm=Phaser.Renderer.WebGL.Utils;var Bm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Rm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Fm=Phaser.Display.Color;var Im={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Fm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},jm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},zm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,jm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};eh();const Nm=Phaser.Display.Canvas.CanvasPool,Gm=Phaser.GameObjects.GameObject,Wm=Phaser.Utils.String.UUID;let Vm=class extends Gm{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Nm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Wm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Nm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Ym=Phaser.GameObjects.Components;Phaser.Class.mixin(Vm,[Ym.Alpha,Ym.BlendMode,Ym.Crop,Ym.Depth,Ym.Flip,Ym.GetBounds,Ym.Mask,Ym.Origin,Ym.Pipeline,Ym.PostPipeline,Ym.ScrollFactor,Ym.Tint,Ym.Transform,Ym.Visible,Bm,Im,zm]);let Xm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Xm.prototype,Zl);var Hm={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const $m=Phaser.Math.RotateAround;var Um;const Km=Phaser.Geom.Rectangle;var qm,Jm=function(t){void 0===qm&&(qm=new Km);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Zm=Phaser.Math.RotateAround;var Qm,ty=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Qm&&(Qm={}),s=Qm),s.x=e,s.y=i,0!==t.rotation&&Zm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ey=Phaser.GameObjects.Components.TransformMatrix;var iy,sy,ry={},ny=function(t,e,i,s,r){var n=ty(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ry);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===iy&&(iy=new ey,sy=new ey),t.parentContainer?t.getWorldTransformMatrix(iy,sy):iy.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),iy.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ay=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ny(t,e,n,a,r)},oy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Um&&(Um={}),s=Um),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&$m(s,0,0,-i.rotation),s}(t,e,this,!0);return Jm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ay(this.parent,this,t,e,i)}};Object.assign(oy,Hm);const hy=Phaser.Math.DegToRad,ly=Phaser.Math.RadToDeg,uy=Phaser.Utils.Objects.GetValue;class cy extends Xm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ly(this._rotation)}set angle(t){this.rotation=hy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=uy(t,"width",void 0),i=uy(t,"height",void 0),s=uy(t,"scaleX",void 0),r=uy(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(cy.prototype,oy);const dy=Phaser.Utils.String.Pad;var py=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${dy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},gy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const fy=Phaser.Utils.Objects.GetValue;let vy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=fy(t,"x",0),i=fy(t,"y",0));var s=this.cornerRadius;s.tl=my(fy(t,"tl",void 0),e,i),s.tr=my(fy(t,"tr",void 0),e,i),s.bl=my(fy(t,"bl",void 0),e,i),s.br=my(fy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){yy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){yy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){yy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){yy(this.cornerRadius.br,t)}};var my=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),by(t),t},yy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=fy(e,"x",0),t.y=fy(e,"y",0)),by(t)},by=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const xy=Phaser.Math.DegToRad;var ky=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},Sy=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,l,h,l,180,270,!1,a):Sy(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,l,h,l,270,360,!1,a):Sy(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,r-l,h,l,0,90,!1,a):Sy(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,r-l,h,l,90,180,!1,a):Sy(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Ty=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),wy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Py=Phaser.Utils.Objects.GetValue;class _y extends cy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Py(e,"color",null),Py(e,"color2",null),Py(e,"horizontalGradient",!0)),this.setStroke(Py(e,"stroke",null),Py(e,"strokeThickness",2)),this.setCornerRadius(Py(e,"cornerRadius",0),Py(e,"cornerIteration",null))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=py(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,gy("color2",t,this),gy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,gy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,gy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ty(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Oy=Phaser.Utils.Objects.GetValue;class Ey extends cy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Oy(e,"color",null),Oy(e,"color2",null),Oy(e,"horizontalGradient",!0)),this.setStroke(Oy(e,"stroke",null),Oy(e,"strokeThickness",2))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=py(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Oy(t,"color2",null),Oy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const My=Phaser.Utils.Objects.GetValue;let Dy=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(My(t,"bold",!1)),this.setItalic(My(t,"italic",!1)),this.setFontSize(My(t,"fontSize","16px")),this.setFontFamily(My(t,"fontFamily","Courier")),this.setColor(My(t,"color","#fff")),this.setStrokeStyle(My(t,"stroke",null),My(t,"strokeThickness",0)),this.setShadow(My(t,"shadowColor",null),My(t,"shadowOffsetX",0),My(t,"shadowOffsetY",0),My(t,"shadowBlur",0)),this.setOffset(My(t,"offsetX",0),My(t,"offsetY",0)),this.setSpace(My(t,"leftSpace",0),My(t,"rightSpace",0)),this.setAlign(My(t,"align",void 0)),this.setBackgroundColor(My(t,"backgroundColor",null)),this.setBackgroundHeight(My(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(My(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(gy("stroke",t,this),gy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(gy("shadowOffsetX",t,this),gy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=py(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=py(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=py(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=py(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ly=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ry="text",By="image",Fy="drawer",Iy="space",jy="command";var zy=function(t){return t.type===Ry&&"\n"===t.text},Ny=function(t){return t.type===Ry&&"\f"===t.text},Gy=function(t){return t.type===Ry};class Wy extends cy{constructor(t,e,i){super(t,Ry),this.updateTextFlag=!1,this.style=new Dy(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Vy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yy=Phaser.Display.Canvas.CanvasPool;var Xy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Yy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Yy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Hy extends cy{constructor(t,e,i){super(t,By),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Xy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class $y extends cy{constructor(t,e,i,s){super(t,Fy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Uy extends cy{constructor(t,e){super(t,Iy),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ky extends Xm{constructor(t,e,i,s,r){super(t,jy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Jy={none:0,word:1,char:2,character:2,mix:3};var Zy=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=ib.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=ib.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=rb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=rb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=rb(t,"wrapMode");void 0===c&&(c=rb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Jy[c]);var d=rb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=rb(t,"letterSpacing",0),g=rb(t,"hAlign",0),f=rb(t,"vAlign",0),v=rb(t,"justifyPercentage",.25),m=qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=O.length,m.isLastPage=!A&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ob(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ob(t,"maxLines",0);var o=0===i,h=ob(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ob(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ob(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ob(t,"letterSpacing",0),p=ob(t,"rtl",!0),g=ob(t,"hAlign",p?2:0),f=ob(t,"vAlign",0),v=qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:E,height:M}),D=Math.max(D,M)),v.start+=_.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return rp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return sp(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ly(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ay(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ry);return null===i?i=new Wy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ay(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Gb(t,r,e,i,n),o=0;o<=jb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Gb(t,r,e,i,n)}return o===jb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wb(t,e,i),t},Nb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Gb=function(t,e,i,s,r){var n,a=Nb(t,e,r),o=Nb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Wb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Vb=Phaser.Utils.Objects.GetValue;var Yb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Vb(e,"minWidth",0),s=Vb(e,"minHeight",0),r=Vb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return zb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),zb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xb=Phaser.Utils.Objects.GetValue,Hb=[function(t){var e=this.scene,i=bm(t,"orientation",0);this.setOrientation(i);var s=bm(t,"icon",void 0),r=bm(t,"iconMask",void 0),n=bm(t,"innerBackground",void 0),a=bm(t,"title",void 0),o=bm(t,"separator",void 0),h=bm(t,"text",void 0),l=bm(t,"action",void 0),u=bm(t,"actionMask",void 0);if(s){var c=bm(t,"align.icon","center");m=0===this.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var d=bm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=ym.call(this,s,s,1)),!d){var p=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",p),bm(t,"iconHeight",p))}}var g=new pm(e,{orientation:1});n&&g.addBackground(n);var f=bm(t,"space.separator",0);if(a){c=bm(t,"align.title","left");var v=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?bm(t,"space.title",f):0,left:bm(t,"space.titleLeft",0),right:bm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=bm(t,"align.text","left");var y,b,x=bm(t,"expandTextWidth",!1);y=bm(t,"expandTextHeight",!1)?1:0,b=x,m={left:bm(t,"space.textLeft",0),right:bm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:bm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=bm(t,"align.action","center");m=0===this.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};d=bm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=ym.call(this,l,l,1)),!d){var k=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",k),bm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=xm(t,"title",void 0),s=xm(t,"separator",void 0),r=xm(t,"innerBackground",void 0),n=xm(t,"icon",void 0),a=xm(t,"iconMask",void 0),o=xm(t,"text",void 0),h=xm(t,"action",void 0),l=xm(t,"actionMask",void 0);if(i){var u=xm(t,"align.title","left"),c=xm(t,"expandTitleWidth",!1);y=xm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:xm(t,"space.title",0),left:xm(t,"space.titleLeft",0),right:xm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=xm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:xm(t,"space.separatorLeft",0),right:xm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=xm(t,"orientation",0),f=new pm(e,{orientation:g,rtl:xm(t,"rtl",!1),space:{left:xm(t,"space.innerLeft",0),right:xm(t,"space.innerRight",0),top:xm(t,"space.innerTop",0),bottom:xm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=xm(t,"align.icon","center");p=0===f.orientation?{right:xm(t,"space.icon",0),top:xm(t,"space.iconTop",0),bottom:xm(t,"space.iconBottom",0),left:xm(t,"space.iconLeft",0)}:{bottom:xm(t,"space.icon",0),left:xm(t,"space.iconLeft",0),right:xm(t,"space.iconRight",0),top:xm(t,"space.iconTop",0)};var v=xm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=ym.call(this,n,n,1)),!v){var m=xm(t,"iconSize",void 0);this.setIconSize(xm(t,"iconWidth",m),xm(t,"iconHeight",m))}}if(o){u=xm(t,"align.text","left");var y,b,x=xm(t,"space.text",0),k=xm(t,"expandTextWidth",!1),C=xm(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=xm(t,"align.action","center");p=0===f.orientation?{top:xm(t,"space.actionTop",0),bottom:xm(t,"space.actionBottom",0),right:xm(t,"space.actionRight",0)}:{left:xm(t,"space.actionLeft",0),right:xm(t,"space.actionRight",0),bottom:xm(t,"space.actionBottom",0)};v=xm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=ym.call(this,h,h,1)),!v){var S=xm(t,"actionSize");this.setActionSize(xm(t,"actionWidth",S),xm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class $b extends mm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Xb(e,"background",void 0);i&&this.addBackground(i);var s=Xb(e,"title",void 0),r=Xb(e,"text",void 0);if(s){var n=Xb(e,"wrapTitle",!1),a=Xb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Ib(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(s,{fitHeight:!0}))}if(r){var o=Xb(e,"wrapText",!1),h=Xb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Ib(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(r,{fitHeight:!0}))}var l=Xb(e,"layoutMode",0);(Hb[l]||Hb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Ub extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=hd(i,"expandTextWidth",!1),n=hd(i,"expandTextHeight",!1);if(r||n){var a=Gc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(hd(i,"typingMode","page")),this.page=new Jc(s,hd(i,"page",void 0)),this.typing=new ad(s,hd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ld[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}($b)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Kb=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Jb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&eu(r,a,e,l,o,h),e.isStroked&&su(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Qb.prototype,Jb);var tx=function(t){return t.x>0&&t.y>0};const ex=Phaser.Utils.Objects.IsPlainObject,ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Geom.Polygon.Earcut;class rx extends Qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(ex(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new vy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ix(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(ix(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,tx(i))if(i.convex){var o=i.x,h=i.y;uu(o,h,i.x,i.y,180,270,!1,a,e)}else{uu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else hu(0,0,e);if(i=n.tr,tx(i))if(i.convex){o=s-i.x,h=i.y;uu(o,h,i.x,i.y,270,360,!1,a,e)}else{uu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else hu(s,0,e);if(i=n.br,tx(i))if(i.convex){o=s-i.x,h=r-i.y;uu(o,h,i.x,i.y,0,90,!1,a,e)}else{uu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else hu(s,r,e);if(i=n.bl,tx(i))if(i.convex){o=i.x,h=r-i.y;uu(o,h,i.x,i.y,90,180,!1,a,e)}else{uu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else hu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=sx(e),this}setShapeType(t){return"string"==typeof t&&(t=nx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const nx={rectangle:0,circle:1};var ax=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ox=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const vx=Phaser.Utils.Objects.GetValue,mx=Phaser.Utils.Objects.IsPlainObject;class yx extends(oc(ql)){constructor(t,e,i,s,r,n,a,o){mx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):mx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):mx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Fu).setName("trackFill")).addShape((new Fu).setName("bar")).addShape((new Fu).setName("trackStroke")),this.setTrackColor(vx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vx(o,"trackStrokeThickness",2),vx(o,"trackStrokeColor",void 0)),this.setSkewX(vx(o,"skewX",0)),this.setRTL(vx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var bx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&fx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),fx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&fx(o,0,0,e,i,t)}};Object.assign(yx.prototype,bx);class xx extends yx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=kx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const kx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(xx.prototype,dx);let Cx=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Sx=Phaser.GameObjects.NineSlice,wx=Phaser.Utils.Objects.GetValue;class Tx extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",null),wx(e,"frame",null),wx(e,"width",0),wx(e,"height",0),wx(e,"leftWidth",0),wx(e,"rightWidth",0),wx(e,"topHeight",0),wx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=wx(e,"effects",!0);i&&Mr(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Tx.prototype,dx);let Px=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const _x=Phaser.GameObjects.Image,Ox=Phaser.Utils.Objects.GetValue;class Ex extends _x{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",""),Ox(e,"frame",void 0)),this.type="rexStatesImage";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Px(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ex.prototype,dx);var Mx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Dx=Phaser.Utils.Objects.IsPlainObject,Lx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Rx[t]),t};const Rx={scale:0,repeat:1};var Bx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:pd,_drawImage:pd,_drawTileSprite:pd,_endDraw:pd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Mx),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Dx(t)?(this.stretchMode.edge=Ax(Lx(t,"edge",0)),this.stretchMode.internal=Ax(Lx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ix=Phaser.Utils.Objects.IsPlainObject,jx=Phaser.Utils.Objects.GetValue;const zx=Phaser.GameObjects;var Nx=void 0,Gx=function(t,e){if(Nx||(Nx={},In(t).events.once("destroy",(function(){for(var t in Nx)Nx[t].destroy();Nx=void 0}))),!Nx.hasOwnProperty(e)){var i=In(t).scene.systemScene;(t=new zx[e](i)).setOrigin(0),Nx[e]=t}return Nx[e]};const Wx=Phaser.GameObjects.RenderTexture;class Vx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Ix(i)?(i=jx(u=i,"x",0),s=jx(u,"y",0),r=jx(u,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(r)?(r=jx(u=r,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(a)?(a=jx(u=a,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(o)?(o=jx(u=o,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=jx(u,"baseFrame",void 0)):Ix(h)&&(h=jx(u=h,"columns",void 0),l=jx(u,"rows",void 0)),void 0===o&&(o=jx(u,"frame",void 0)),void 0===h){var c=jx(u,"leftWidth",void 0),d=jx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=jx(u,"topHeight",void 0),g=jx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(jx(u,"getFrameNameCallback",void 0)),this.setStretchMode(jx(u,"stretchMode",0)),this.setPreserveRatio(jx(u,"preserveRatio",!0));var f=jx(u,"maxFixedPartScale",1),v=jx(u,"maxFixedPartScaleX",f),m=jx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Fx),i}(Wx,"rexNinePatch")){}var Yx={_drawImage:function(t,e,i,s,r,n){var a=Gx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Gx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vx.prototype,Yx);let Xx=class extends zn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Hx=Phaser.Utils.Objects.GetValue;class $x extends Vx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Hx(e,"effects",!0);i&&Mr(this,i),this.style=new Xx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign($x.prototype,dx);const Ux=["alpha","tint","flipX","flipY"];var Kx=function(t,e){if(!e)return t;for(var i=0,s=Ux.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexmenu.js b/dist/rexmenu.js index ca2e492ddb..ef3c65db83 100644 --- a/dist/rexmenu.js +++ b/dist/rexmenu.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$4(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$4(config, 'offsetX', 0); + offsetY = GetValue$4(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexmenu.min.js b/dist/rexmenu.min.js index 561bee6221..6a239f4a2b 100644 --- a/dist/rexmenu.min.js +++ b/dist/rexmenu.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Oe=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},we=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},Te={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return we(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return we(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return hi(t,0,1)}set t(t){(t=hi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Oi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var a={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new xi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new xi(t,o):n.resetFromJSON(o),n.restart(),n},wi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return wi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var a,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i}var l={mode:2,start:a,end:h,duration:e/2,ease:n,repeat:s};return void 0===o?o=new xi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Di),Mi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,o):s.resetFromJSON(o),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Yi=Phaser.Utils.Objects.IsPlainObject;var Fi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},ji={};Object.assign(ji,Fi),ji.onInitFade=function(){Fi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Vi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Vi&&(o=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Vi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Vi&&(o=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Vi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const os=Phaser.Utils.Objects.GetValue,as=Phaser.Math.Linear;class hs extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=as(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new hs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),wi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,Ms,Rs,Ls,zs);const As=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ns.prototype,Is);var Bs=function(t){if(t.parentContainer)return Bs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Bs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Bs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,a=r/2,h=n/2,l=r*o,d=n*o;e.x===a&&e.y===h||e.setPosition(a,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class Fs extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const js=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(js(t,"hitAreaMode",0)),this.setEnable(js(t,"enable",!0)),this.setStopMode(js(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ns{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,h=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,a=n.pointers,h=0;h0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",an="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case wn:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(On.prototype,We);var Pn={};const _n=0,wn=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Bn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(An(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=zn(An(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Bn);const Xn="IDLE",Yn="BEGIN",Fn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ir.call(t,e),Br.call(t,e),Fr.call(t,e),Ur.call(t,e),Wn.call(t,e),Un.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,a=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var h=ne(e,"name",!1);h&&(r=ne(h,"createTextCallback",ae),n=ne(h,"createTextCallbackScope",void 0),"string"==typeof(o=ne(h,"align","left-top"))&&(o=zt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=o)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=o+1),r};const no=Phaser.Utils.Objects.IsPlainObject,oo=Phaser.Utils.Objects.GetValue,ao=Phaser.Display.Align.CENTER,ho={min:0,full:-1};var lo=function(t,e,i,s,r,n,o,a,h,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ho[e];else if(no(e)){var u;e=oo(u=e,"proportion",void 0),i=oo(u,"align",ao),s=oo(u,"padding",0),r=oo(u,"expand",!1),n=oo(u,"key",void 0),o=oo(u,"index",void 0),t.isRexSizer||(a=oo(u,"minWidth",void 0),h=oo(u,"minHeight",void 0)),l=oo(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ao),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},co={add:lo,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lo.call(this,new so(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,a){return no(i)&&(i.index=t),lo.call(this,e,i,s,r,n,o,t,a),this},insertAtPosition(t,e,i,s,r,n,o,a,h){var l=ro.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,a,h),this}};const uo=wt.prototype.clear;var po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uo.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},fo={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},mo={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yo={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Co={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,a=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,o+=n)))}return h?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,a,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eo.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eo.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Co,co,go,fo,mo,yo,bo);var So=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},xo=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Oo=Phaser.Utils.Objects.IsPlainObject,Po=Phaser.Utils.Objects.GetValue;class _o extends Kn{constructor(t,e,i,s,r,n,o){Oo(e)?(e=Po(o=e,"x",0),i=Po(o,"y",0),s=Po(o,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):Oo(s)?(s=Po(o=s,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):Oo(n)&&(n=Po(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Po(o,"space.item",0)),this.setStartChildIndex(Po(o,"startChildIndex",0)),this.setRTL(Po(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=xo(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=So.call(this)),this._childrenProportion}}Object.assign(_o.prototype,Co);const wo=_o.prototype.add,To=_o.prototype.addSpace;var ko=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&To.call(this),wo.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&To.call(this),this.hasTailSpace=s}else wo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;wo.call(this,t,{index:r,proportion:i,expand:!0})}else wo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Do={addButton(t){if(ar(t))for(var e=t,i=0,s=e.length;i=0;i--)Lo.call(this,e[i],t);return this}},Io=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Ao=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Io.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},No={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Ao.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const B=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Oe=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},we=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},Te={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return we(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return we(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return hi(t,0,1)}set t(t){(t=hi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Oi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var a={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new xi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new xi(t,o):n.resetFromJSON(o),n.restart(),n},wi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return wi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var a,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i}var l={mode:2,start:a,end:h,duration:e/2,ease:n,repeat:s};return void 0===o?o=new xi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Di),Mi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,o):s.resetFromJSON(o),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Fi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},ji={};Object.assign(ji,Fi),ji.onInitFade=function(){Fi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Vi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Vi&&(o=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Vi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Vi&&(o=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Vi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const os=Phaser.Utils.Objects.GetValue,as=Phaser.Math.Linear;class hs extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=as(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new hs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),wi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,Ms,Rs,Ls,zs);const As=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ns.prototype,Is);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Ys extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,a=r/2,h=n/2,l=r*o,d=n*o;e.x===a&&e.y===h||e.setPosition(a,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Fs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const js=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(js(t,"hitAreaMode",0)),this.setEnable(js(t,"enable",!0)),this.setStopMode(js(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},$s=function(t,e){Yi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ns{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,h=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,a=n.pointers,h=0;h0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=an,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",an="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case wn:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(On.prototype,We);var Pn={};const _n=0,wn=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(An(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=zn(An(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Yn="IDLE",Bn="BEGIN",Fn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ir.call(t,e),Xr.call(t,e),Fr.call(t,e),Ur.call(t,e),Wn.call(t,e),Un.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,a=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var h=ne(e,"name",!1);h&&(r=ne(h,"createTextCallback",ae),n=ne(h,"createTextCallbackScope",void 0),"string"==typeof(o=ne(h,"align","left-top"))&&(o=zt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=o)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=o+1),r};const no=Phaser.Utils.Objects.IsPlainObject,oo=Phaser.Utils.Objects.GetValue,ao=Phaser.Display.Align.CENTER,ho={min:0,full:-1};var lo=function(t,e,i,s,r,n,o,a,h,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ho[e];else if(no(e)){var v;e=oo(v=e,"proportion",void 0),i=oo(v,"align",ao),s=oo(v,"padding",0),r=oo(v,"expand",!1),n=oo(v,"key",void 0),o=oo(v,"index",void 0),t.isRexSizer||(a=oo(v,"minWidth",void 0),h=oo(v,"minHeight",void 0)),l=oo(v,"fitRatio",0),d=oo(v,"offsetX",0),c=oo(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ao),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},co={add:lo,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lo.call(this,new so(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,a){return no(i)&&(i.index=t),lo.call(this,e,i,s,r,n,o,t,a),this},insertAtPosition(t,e,i,s,r,n,o,a,h){var l=ro.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,a,h),this}};const uo=wt.prototype.clear;var po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),uo.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,po.call(this,t),this}},fo={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},mo={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yo={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Co={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,a=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,o+=n)))}return h?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,a,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eo.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eo.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Co,co,go,fo,mo,yo,bo);var So=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},xo=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Oo=Phaser.Utils.Objects.IsPlainObject,Po=Phaser.Utils.Objects.GetValue;class _o extends Kn{constructor(t,e,i,s,r,n,o){Oo(e)?(e=Po(o=e,"x",0),i=Po(o,"y",0),s=Po(o,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):Oo(s)?(s=Po(o=s,"width",void 0),r=Po(o,"height",void 0),n=Po(o,"orientation",0)):Oo(n)&&(n=Po(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Po(o,"space.item",0)),this.setStartChildIndex(Po(o,"startChildIndex",0)),this.setRTL(Po(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=xo(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=So.call(this)),this._childrenProportion}}Object.assign(_o.prototype,Co);const wo=_o.prototype.add,To=_o.prototype.addSpace;var ko=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&To.call(this),wo.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&To.call(this),this.hasTailSpace=s}else wo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;wo.call(this,t,{index:r,proportion:i,expand:!0})}else wo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Do={addButton(t){if(ar(t))for(var e=t,i=0,s=e.length;i=0;i--)Lo.call(this,e[i],t);return this}},Io=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Ao=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Io.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},No={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Ao.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -13187,6 +13203,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rexnameinputdialog.min.js b/dist/rexnameinputdialog.min.js index c60db3539c..3f340b3338 100644 --- a/dist/rexnameinputdialog.min.js +++ b/dist/rexnameinputdialog.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},z={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},De=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Li),zi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Ni),Hi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,zs,Ds,As,Ys);const Bs=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;let Ns=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Gs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Ns{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Kr=0,qr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return qe(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=xn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=xn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const xn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,Ge);var _n={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(Xn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Wn(Xn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Nn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Wr.call(t,e),jr.call(t,e),Nr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=_t.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,ph,mh,yh,bh,xh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class _h extends eh{constructor(t,e,i,s,r,n,h){Th(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,Sh);var Eh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},zh={};const Dh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Wh=Phaser.Utils.String.UUID;var Bh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),Dh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Wh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Dh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return gh.call(this,t),this}},jh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,zh.width=a,zh.height=o,a=(l=Eh(Lh,zh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Bh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Nh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Nh.prototype,jh);const Hh=_h.prototype.add,Gh=_h.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Gh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Qh=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Qh.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},xa={add(t,e,i){if(lr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},wa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Wa=Phaser.Utils.Objects.GetValue;class Ba extends _a{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new aa({parent:this,eventEmitter:Wa(e,"eventEmitter",this),groupName:Wa(e,"groupName",void 0),clickConfig:Wa(e,"click",void 0)}).setButtonsType(e);var s=Wa(e,"background",void 0),r=Wa(e,"buttons",void 0);this.buttonsAlign=Wa(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ba.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Na=Phaser.Display.Align.CENTER;var Ha=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Za={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Go=0,Vo=1,Uo=2,$o=0,Jo=1,Ko=2,qo=/(?:\r\n|\r|\n)/;const Zo={none:$o,word:Jo,char:Ko,character:Ko,mix:3},Qo=Phaser.Renderer.WebGL.Utils;var tl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Qo.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const el=Phaser.Display.Color;var il={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new el);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},sl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},rl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,sl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const nl=Phaser.Display.Canvas.CanvasPool,hl=Phaser.GameObjects.GameObject,al=Phaser.Utils.String.UUID;class ol extends hl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=nl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=al(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){nl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ll=Phaser.GameObjects.Components;Phaser.Class.mixin(ol,[ll.Alpha,ll.BlendMode,ll.Crop,ll.Depth,ll.Flip,ll.GetBounds,ll.Mask,ll.Origin,ll.Pipeline,ll.PostPipeline,ll.ScrollFactor,ll.Tint,ll.Transform,ll.Visible,tl,il,rl]);var dl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class cl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(cl.prototype,dl);var ul={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const pl=Phaser.Math.RotateAround;var vl;const gl=Phaser.Geom.Rectangle;var fl,ml=function(t){void 0===fl&&(fl=new gl);var e=t.drawTLX,i=t.drawTLY;return fl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),fl};const yl=Phaser.Math.RotateAround;var bl,xl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===bl&&(bl={}),s=bl),s.x=e,s.y=i,0!==t.rotation&&yl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Cl=Phaser.GameObjects.Components.TransformMatrix;var Sl,wl,Ol={},Pl=function(t,e,i,s,r){var n=xl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ol);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sl&&(Sl=new Cl,wl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Sl,wl):Sl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Tl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Pl(t,e,n,h,r)},kl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&pl(s,0,0,-i.rotation),s}(t,e,this,!0);return ml(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Tl(this.parent,this,t,e,i)}};Object.assign(kl,ul);const _l=Phaser.Math.DegToRad,El=Phaser.Math.RadToDeg,Ml=Phaser.Utils.Objects.GetValue;class Rl extends cl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return El(this._rotation)}set angle(t){this.rotation=_l(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ml(t,"width",void 0),i=Ml(t,"height",void 0),s=Ml(t,"scaleX",void 0),r=Ml(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Rl.prototype,kl);const Ll=Phaser.Utils.String.Pad;var zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ll(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Dl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Al=Phaser.Utils.Objects.GetValue;let Yl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Al(t,"x",0),i=Al(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Al(t,"tl",void 0),e,i),s.tr=Wl(Al(t,"tr",void 0),e,i),s.bl=Wl(Al(t,"bl",void 0),e,i),s.br=Wl(Al(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bl(this.cornerRadius.br,t)}};var Wl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xl(t),t},Bl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Al(e,"x",0),t.y=Al(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const jl=Phaser.Math.DegToRad;var Il=function(t){return!t.hasOwnProperty("convex")||t.convex},Fl=function(t){return t.x>0&&t.y>0},Nl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,l,o,l,180,270,!1,h):Nl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,l,o,l,270,360,!1,h):Nl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,r-l,o,l,0,90,!1,h):Nl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,r-l,o,l,90,180,!1,h):Nl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Gl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Hl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Vl=Phaser.Utils.Objects.GetValue;class Ul extends Rl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2)),this.setCornerRadius(Vl(e,"cornerRadius",0),Vl(e,"cornerIteration",null))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Dl("color2",t,this),Dl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Dl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Gl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const $l=Phaser.Utils.Objects.GetValue;class Jl extends Rl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor($l(e,"color",null),$l(e,"color2",null),$l(e,"horizontalGradient",!0)),this.setStroke($l(e,"stroke",null),$l(e,"strokeThickness",2))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,$l(t,"color2",null),$l(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$l(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Kl=Phaser.Utils.Objects.GetValue;let ql=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Kl(t,"bold",!1)),this.setItalic(Kl(t,"italic",!1)),this.setFontSize(Kl(t,"fontSize","16px")),this.setFontFamily(Kl(t,"fontFamily","Courier")),this.setColor(Kl(t,"color","#fff")),this.setStrokeStyle(Kl(t,"stroke",null),Kl(t,"strokeThickness",0)),this.setShadow(Kl(t,"shadowColor",null),Kl(t,"shadowOffsetX",0),Kl(t,"shadowOffsetY",0),Kl(t,"shadowBlur",0)),this.setOffset(Kl(t,"offsetX",0),Kl(t,"offsetY",0)),this.setSpace(Kl(t,"leftSpace",0),Kl(t,"rightSpace",0)),this.setAlign(Kl(t,"align",void 0)),this.setBackgroundColor(Kl(t,"backgroundColor",null)),this.setBackgroundHeight(Kl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Kl(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Dl("stroke",t,this),Dl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Dl("shadowOffsetX",t,this),Dl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=zl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=zl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Zl=Phaser.Utils.Array.Remove,Ql=Phaser.Utils.Array.Remove,td="text",ed="image",id="drawer",sd="space",rd="command";var nd=function(t){return t.type===td&&"\n"===t.text},hd=function(t){return t.type===td&&"\f"===t.text},ad=function(t){return t.type===td};class od extends Rl{constructor(t,e,i){super(t,td),this.updateTextFlag=!1,this.style=new ql(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ld=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const dd=Phaser.Display.Canvas.CanvasPool;var cd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=dd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),dd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ud extends Rl{constructor(t,e,i){super(t,ed),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){cd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pd extends Rl{constructor(t,e,i,s){super(t,id),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vd extends Rl{constructor(t,e){super(t,sd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class gd extends cl{constructor(t,e,i,s,r){super(t,rd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function fd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>fd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=fd(t[i]));return e}var md=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const yd={none:0,word:1,char:2,character:2,mix:3};var bd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=wd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Pd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Pd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Pd(t,"wrapMode");void 0===c&&(c=Pd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yd[c]);var u=Pd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Pd(t,"letterSpacing",0),v=Pd(t,"hAlign",0),g=Pd(t,"vAlign",0),f=Pd(t,"justifyPercentage",.25),m=md({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!z&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=0===i,o=_d(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_d(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_d(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_d(t,"letterSpacing",0),p=_d(t,"rtl",!0),v=_d(t,"hAlign",p?2:0),g=_d(t,"vAlign",0),f=md({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Zl(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ql(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(td);return null===i?i=new od(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Tl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Qd=Phaser.Utils.Objects.GetFastValue;var tc={};class ec{constructor(t){this.pools=Qd(t,"pools",tc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Zd),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=lc(t,r,e,i,n),a=0;a<=hc&&0!==h;a++){if((r+=h)<0){r=0;break}h=lc(t,r,e,i,n)}return a===hc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),dc(t,e,i),t},oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},lc=function(t,e,i,s,r){var n,h=oc(t,e,r),a=oc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},dc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const cc=Phaser.Utils.Objects.GetValue,uc=Phaser.Utils.Objects.GetValue;class pc extends Eo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=uc(e,"background",void 0),r=uc(e,"icon",void 0),n=uc(e,"iconMask",void 0),h=uc(e,"text",void 0),a=uc(e,"action",void 0),o=uc(e,"actionMask",void 0),l=uc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:uc(e,"space.icon",0),top:uc(e,"space.iconTop",0),bottom:uc(e,"space.iconBottom",0),left:uc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:uc(e,"space.icon",0),left:uc(e,"space.iconLeft",0),right:uc(e,"space.iconRight",0),top:uc(e,"space.iconTop",0)});var d=uc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ao.call(this,r,r,1)),!d){var c=uc(e,"iconSize",void 0);this.setIconSize(uc(e,"iconWidth",c),uc(e,"iconHeight",c))}}if(h){var u=uc(e,"wrapText",!1),p=uc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(jo(t)){case 0:switch("string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=No;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,nc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=cc(e,"minWidth",0),s=cc(e,"minHeight",0),r=cc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ac(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ac(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=uc(e,"space.text",0),m=uc(e,"expandTextWidth",!1),y=uc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:uc(e,"space.actionTop",0),bottom:uc(e,"space.actionBottom",0),right:uc(e,"space.actionRight",0)}:{left:uc(e,"space.actionLeft",0),right:uc(e,"space.actionRight",0),bottom:uc(e,"space.actionBottom",0)},d=uc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ao.call(this,a,a,1)),!d)){var b=uc(e,"actionSize");this.setActionSize(uc(e,"actionWidth",b),uc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var vc=Phaser.Renderer.WebGL.Utils,gc=function(t,e,i,s,r,n){for(var h=vc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},xc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cc=Phaser.Renderer.Canvas.SetTransform;var Sc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=yc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&gc(r,h,e,l,a,o),e.isStroked&&mc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Oc.prototype,Sc);var Pc=function(t){return t.x>0&&t.y>0},Tc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const kc=Phaser.Math.DegToRad;var _c=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Eu=Phaser.Utils.Objects.GetValue,Mu=Phaser.Utils.Objects.IsPlainObject;class Ru extends(iu($c)){constructor(t,e,i,s,r,n,h,a){Mu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Mu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Mu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new ku).setName("trackFill")).addShape((new ku).setName("bar")).addShape((new ku).setName("trackStroke")),this.setTrackColor(Eu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Eu(a,"trackStrokeThickness",2),Eu(a,"trackStrokeColor",void 0)),this.setSkewX(Eu(a,"skewX",0)),this.setRTL(Eu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Lu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&_u(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),_u(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_u(a,0,0,e,i,t)}};Object.assign(Ru.prototype,Lu);var zu=function(t){return null==t||""===t||0===t.length},Du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(zu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(zu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=fd(i),s=fd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zu(t)?(this.stretchMode.edge=tp(Qu(t,"edge",0)),this.stretchMode.internal=tp(Qu(t,"internal",0))):(t=tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ip.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Utils.Objects.GetValue,hp=Phaser.GameObjects;var ap=void 0,op=function(t,e){if(ap||(ap={},qe(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new hp[e](i)).setOrigin(0),ap[e]=t}return ap[e]};const lp=Phaser.GameObjects.RenderTexture;class dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rp(i)?(i=np(d=i,"x",0),s=np(d,"y",0),r=np(d,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(r)?(r=np(d=r,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(h)?(h=np(d=h,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(a)?(a=np(d=a,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=np(d,"baseFrame",void 0)):rp(o)&&(o=np(d=o,"columns",void 0),l=np(d,"rows",void 0)),void 0===a&&(a=np(d,"frame",void 0)),void 0===o){var c=np(d,"leftWidth",void 0),u=np(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=np(d,"topHeight",void 0),v=np(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(np(d,"getFrameNameCallback",void 0)),this.setStretchMode(np(d,"stretchMode",0)),this.setPreserveRatio(np(d,"preserveRatio",!0));var g=np(d,"maxFixedPartScale",1),f=np(d,"maxFixedPartScaleX",g),m=np(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sp),i}(lp,"rexNinePatch")){}var cp={_drawImage:function(t,e,i,s,r,n){var h=op(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=op(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dp.prototype,cp);let up=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pp=Phaser.Utils.Objects.GetValue;class vp extends dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pp(e,"effects",!0);i&&Fu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,jc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},z={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},De=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Li),zi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Ni),Hi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ys={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,zs,Ds,As,Ys);const Bs=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;let Ns=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Gs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Ns{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Lr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Kr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Kr=0,qr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return qe(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=xn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=xn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const xn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ln,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,Ge);var _n={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(Xn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Wn(Xn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Nn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Wr.call(t,e),jr.call(t,e),Nr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ch[e];else if(oh(e)){var v;e=lh(v=e,"proportion",void 0),i=lh(v,"align",dh),s=lh(v,"padding",0),r=lh(v,"expand",!1),n=lh(v,"key",void 0),h=lh(v,"index",void 0),t.isRexSizer||(a=lh(v,"minWidth",void 0),o=lh(v,"minHeight",void 0)),l=lh(v,"fitRatio",0),d=lh(v,"offsetX",0),c=lh(v,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=_t.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,ph,mh,yh,bh,xh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class _h extends eh{constructor(t,e,i,s,r,n,h){Th(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,Sh);var Eh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},zh={};const Dh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Wh=Phaser.Utils.String.UUID;var Bh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),Dh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Wh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Dh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ce.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return gh.call(this,t),this}},jh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,zh.width=a,zh.height=o,a=(l=Eh(Lh,zh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Bh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Nh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Nh.prototype,jh);const Hh=_h.prototype.add,Gh=_h.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Gh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Qh=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Qh.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},xa={add(t,e,i){if(lr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},wa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Wa=Phaser.Utils.Objects.GetValue;class Ba extends _a{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new aa({parent:this,eventEmitter:Wa(e,"eventEmitter",this),groupName:Wa(e,"groupName",void 0),clickConfig:Wa(e,"click",void 0)}).setButtonsType(e);var s=Wa(e,"background",void 0),r=Wa(e,"buttons",void 0);this.buttonsAlign=Wa(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ba.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Na=Phaser.Display.Align.CENTER;var Ha=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Za={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Go=0,Vo=1,Uo=2,$o=0,Jo=1,Ko=2,qo=/(?:\r\n|\r|\n)/;const Zo={none:$o,word:Jo,char:Ko,character:Ko,mix:3},Qo=Phaser.Renderer.WebGL.Utils;var tl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Qo.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const el=Phaser.Display.Color;var il={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new el);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},sl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},rl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,sl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const nl=Phaser.Display.Canvas.CanvasPool,hl=Phaser.GameObjects.GameObject,al=Phaser.Utils.String.UUID;class ol extends hl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=nl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=al(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){nl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ll=Phaser.GameObjects.Components;Phaser.Class.mixin(ol,[ll.Alpha,ll.BlendMode,ll.Crop,ll.Depth,ll.Flip,ll.GetBounds,ll.Mask,ll.Origin,ll.Pipeline,ll.PostPipeline,ll.ScrollFactor,ll.Tint,ll.Transform,ll.Visible,tl,il,rl]);var dl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class cl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(cl.prototype,dl);var ul={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const pl=Phaser.Math.RotateAround;var vl;const gl=Phaser.Geom.Rectangle;var fl,ml=function(t){void 0===fl&&(fl=new gl);var e=t.drawTLX,i=t.drawTLY;return fl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),fl};const yl=Phaser.Math.RotateAround;var bl,xl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===bl&&(bl={}),s=bl),s.x=e,s.y=i,0!==t.rotation&&yl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Cl=Phaser.GameObjects.Components.TransformMatrix;var Sl,wl,Ol={},Pl=function(t,e,i,s,r){var n=xl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ol);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sl&&(Sl=new Cl,wl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Sl,wl):Sl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Tl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Pl(t,e,n,h,r)},kl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&pl(s,0,0,-i.rotation),s}(t,e,this,!0);return ml(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Tl(this.parent,this,t,e,i)}};Object.assign(kl,ul);const _l=Phaser.Math.DegToRad,El=Phaser.Math.RadToDeg,Ml=Phaser.Utils.Objects.GetValue;class Rl extends cl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return El(this._rotation)}set angle(t){this.rotation=_l(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ml(t,"width",void 0),i=Ml(t,"height",void 0),s=Ml(t,"scaleX",void 0),r=Ml(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Rl.prototype,kl);const Ll=Phaser.Utils.String.Pad;var zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ll(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Dl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Al=Phaser.Utils.Objects.GetValue;let Yl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Al(t,"x",0),i=Al(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Al(t,"tl",void 0),e,i),s.tr=Wl(Al(t,"tr",void 0),e,i),s.bl=Wl(Al(t,"bl",void 0),e,i),s.br=Wl(Al(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bl(this.cornerRadius.br,t)}};var Wl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xl(t),t},Bl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Al(e,"x",0),t.y=Al(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const jl=Phaser.Math.DegToRad;var Il=function(t){return!t.hasOwnProperty("convex")||t.convex},Fl=function(t){return t.x>0&&t.y>0},Nl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,l,o,l,180,270,!1,h):Nl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,l,o,l,270,360,!1,h):Nl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,r-l,o,l,0,90,!1,h):Nl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,r-l,o,l,90,180,!1,h):Nl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Gl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Hl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Vl=Phaser.Utils.Objects.GetValue;class Ul extends Rl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2)),this.setCornerRadius(Vl(e,"cornerRadius",0),Vl(e,"cornerIteration",null))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Dl("color2",t,this),Dl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Dl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Gl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const $l=Phaser.Utils.Objects.GetValue;class Jl extends Rl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor($l(e,"color",null),$l(e,"color2",null),$l(e,"horizontalGradient",!0)),this.setStroke($l(e,"stroke",null),$l(e,"strokeThickness",2))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,$l(t,"color2",null),$l(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$l(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Kl=Phaser.Utils.Objects.GetValue;let ql=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Kl(t,"bold",!1)),this.setItalic(Kl(t,"italic",!1)),this.setFontSize(Kl(t,"fontSize","16px")),this.setFontFamily(Kl(t,"fontFamily","Courier")),this.setColor(Kl(t,"color","#fff")),this.setStrokeStyle(Kl(t,"stroke",null),Kl(t,"strokeThickness",0)),this.setShadow(Kl(t,"shadowColor",null),Kl(t,"shadowOffsetX",0),Kl(t,"shadowOffsetY",0),Kl(t,"shadowBlur",0)),this.setOffset(Kl(t,"offsetX",0),Kl(t,"offsetY",0)),this.setSpace(Kl(t,"leftSpace",0),Kl(t,"rightSpace",0)),this.setAlign(Kl(t,"align",void 0)),this.setBackgroundColor(Kl(t,"backgroundColor",null)),this.setBackgroundHeight(Kl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Kl(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Dl("stroke",t,this),Dl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Dl("shadowOffsetX",t,this),Dl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=zl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=zl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Zl=Phaser.Utils.Array.Remove,Ql=Phaser.Utils.Array.Remove,td="text",ed="image",id="drawer",sd="space",rd="command";var nd=function(t){return t.type===td&&"\n"===t.text},hd=function(t){return t.type===td&&"\f"===t.text},ad=function(t){return t.type===td};class od extends Rl{constructor(t,e,i){super(t,td),this.updateTextFlag=!1,this.style=new ql(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ld=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const dd=Phaser.Display.Canvas.CanvasPool;var cd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=dd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),dd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ud extends Rl{constructor(t,e,i){super(t,ed),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){cd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pd extends Rl{constructor(t,e,i,s){super(t,id),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vd extends Rl{constructor(t,e){super(t,sd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class gd extends cl{constructor(t,e,i,s,r){super(t,rd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function fd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>fd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=fd(t[i]));return e}var md=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const yd={none:0,word:1,char:2,character:2,mix:3};var bd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=wd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Pd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Pd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Pd(t,"wrapMode");void 0===c&&(c=Pd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yd[c]);var u=Pd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Pd(t,"letterSpacing",0),v=Pd(t,"hAlign",0),g=Pd(t,"vAlign",0),f=Pd(t,"justifyPercentage",.25),m=md({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!z&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=0===i,o=_d(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_d(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_d(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_d(t,"letterSpacing",0),p=_d(t,"rtl",!0),v=_d(t,"hAlign",p?2:0),g=_d(t,"vAlign",0),f=md({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Zl(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ql(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(td);return null===i?i=new od(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Tl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Qd=Phaser.Utils.Objects.GetFastValue;var tc={};class ec{constructor(t){this.pools=Qd(t,"pools",tc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Zd),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=lc(t,r,e,i,n),a=0;a<=hc&&0!==h;a++){if((r+=h)<0){r=0;break}h=lc(t,r,e,i,n)}return a===hc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),dc(t,e,i),t},oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},lc=function(t,e,i,s,r){var n,h=oc(t,e,r),a=oc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},dc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const cc=Phaser.Utils.Objects.GetValue,uc=Phaser.Utils.Objects.GetValue;class pc extends Eo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=uc(e,"background",void 0),r=uc(e,"icon",void 0),n=uc(e,"iconMask",void 0),h=uc(e,"text",void 0),a=uc(e,"action",void 0),o=uc(e,"actionMask",void 0),l=uc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:uc(e,"space.icon",0),top:uc(e,"space.iconTop",0),bottom:uc(e,"space.iconBottom",0),left:uc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:uc(e,"space.icon",0),left:uc(e,"space.iconLeft",0),right:uc(e,"space.iconRight",0),top:uc(e,"space.iconTop",0)});var d=uc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ao.call(this,r,r,1)),!d){var c=uc(e,"iconSize",void 0);this.setIconSize(uc(e,"iconWidth",c),uc(e,"iconHeight",c))}}if(h){var u=uc(e,"wrapText",!1),p=uc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(jo(t)){case 0:switch("string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=No;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,nc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=cc(e,"minWidth",0),s=cc(e,"minHeight",0),r=cc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ac(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ac(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=uc(e,"space.text",0),m=uc(e,"expandTextWidth",!1),y=uc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:uc(e,"space.actionTop",0),bottom:uc(e,"space.actionBottom",0),right:uc(e,"space.actionRight",0)}:{left:uc(e,"space.actionLeft",0),right:uc(e,"space.actionRight",0),bottom:uc(e,"space.actionBottom",0)},d=uc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ao.call(this,a,a,1)),!d)){var b=uc(e,"actionSize");this.setActionSize(uc(e,"actionWidth",b),uc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var vc=Phaser.Renderer.WebGL.Utils,gc=function(t,e,i,s,r,n){for(var h=vc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},xc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cc=Phaser.Renderer.Canvas.SetTransform;var Sc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=yc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&gc(r,h,e,l,a,o),e.isStroked&&mc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Oc.prototype,Sc);var Pc=function(t){return t.x>0&&t.y>0},Tc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const kc=Phaser.Math.DegToRad;var _c=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Eu=Phaser.Utils.Objects.GetValue,Mu=Phaser.Utils.Objects.IsPlainObject;class Ru extends(iu($c)){constructor(t,e,i,s,r,n,h,a){Mu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Mu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Mu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new ku).setName("trackFill")).addShape((new ku).setName("bar")).addShape((new ku).setName("trackStroke")),this.setTrackColor(Eu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Eu(a,"trackStrokeThickness",2),Eu(a,"trackStrokeColor",void 0)),this.setSkewX(Eu(a,"skewX",0)),this.setRTL(Eu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Lu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&_u(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),_u(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_u(a,0,0,e,i,t)}};Object.assign(Ru.prototype,Lu);var zu=function(t){return null==t||""===t||0===t.length},Du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(zu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(zu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=fd(i),s=fd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zu(t)?(this.stretchMode.edge=tp(Qu(t,"edge",0)),this.stretchMode.internal=tp(Qu(t,"internal",0))):(t=tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ip.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Utils.Objects.GetValue,hp=Phaser.GameObjects;var ap=void 0,op=function(t,e){if(ap||(ap={},qe(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new hp[e](i)).setOrigin(0),ap[e]=t}return ap[e]};const lp=Phaser.GameObjects.RenderTexture;class dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rp(i)?(i=np(d=i,"x",0),s=np(d,"y",0),r=np(d,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(r)?(r=np(d=r,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(h)?(h=np(d=h,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(a)?(a=np(d=a,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=np(d,"baseFrame",void 0)):rp(o)&&(o=np(d=o,"columns",void 0),l=np(d,"rows",void 0)),void 0===a&&(a=np(d,"frame",void 0)),void 0===o){var c=np(d,"leftWidth",void 0),u=np(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=np(d,"topHeight",void 0),v=np(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(np(d,"getFrameNameCallback",void 0)),this.setStretchMode(np(d,"stretchMode",0)),this.setPreserveRatio(np(d,"preserveRatio",!0));var g=np(d,"maxFixedPartScale",1),f=np(d,"maxFixedPartScaleX",g),m=np(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sp),i}(lp,"rexNinePatch")){}var cp={_drawImage:function(t,e,i,s,r,n){var h=op(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=op(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dp.prototype,cp);let up=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pp=Phaser.Utils.Objects.GetValue;class vp extends dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pp(e,"effects",!0);i&&Fu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,jc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexnamevaluelabel.js b/dist/rexnamevaluelabel.js index 0923ba74bb..84c18e3b98 100644 --- a/dist/rexnamevaluelabel.js +++ b/dist/rexnamevaluelabel.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$5(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$5(config, 'offsetX', 0); + offsetY = GetValue$5(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexnamevaluelabel.min.js b/dist/rexnamevaluelabel.min.js index f2904e4e4c..1f24a6b073 100644 --- a/dist/rexnamevaluelabel.min.js +++ b/dist/rexnamevaluelabel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=_(t.scaleX,i.scaleX),e.scaleY=_(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},O={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=_(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const V=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=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};const Pe=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Oe={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case ui:case pi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===vi}get isRunning(){return this.state===ui||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,vi=2,pi=3,gi=-1;class fi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class bi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class _i extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new _i(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new _i(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Oi=function(t){return Ei(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Oi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Oi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Oi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new _i(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Oi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Fi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Vi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Oi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Oi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Oi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Hi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Oi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Oi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Oi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Oi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Oi(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Os={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Ft),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Ft),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Os,Ms,Ds,Rs);const zs=Phaser.Utils.Objects.GetValue;class As extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ls);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Is extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Ys extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const br=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=br(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class kr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Or=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class vn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=pn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=pn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,on);const pn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,bn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case _n:this.tracerState=Tn,this.onDrag1End();break;case Pn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Be);var Sn={};const Tn=0,_n=1,Pn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},On={};const Mn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=On),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Ln(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Xn}break;case Xn:t=Dn(Ln(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Xn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const Fn="IDLE",In="BEGIN",Xn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Rr.call(t,e),Ar.call(t,e),Xr.call(t,e),Nr.call(t,e),Vn.call(t,e),Nn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Ot(t)},getChildPrevState:function(t){var e=Ot(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),v=0,p=u.length;v(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=na[e];else if(ia(e)){var u;e=sa(u=e,"proportion",void 0),i=sa(u,"align",ra),s=sa(u,"padding",0),r=sa(u,"expand",!1),n=sa(u,"key",void 0),a=sa(u,"index",void 0),t.isRexSizer||(h=sa(u,"minWidth",void 0),o=sa(u,"minHeight",void 0)),l=sa(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ua={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,v=this.innerWidth,p=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(fa,ha,ca,ua,va,pa,ga);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,ba=Phaser.Utils.Objects.GetValue;class xa extends $n{constructor(t,e,i,s,r,n,a){Ca(e)?(e=ba(a=e,"x",0),i=ba(a,"y",0),s=ba(a,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(s)?(s=ba(a=s,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(n)&&(n=ba(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(ba(a,"space.item",0)),this.setStartChildIndex(ba(a,"startChildIndex",0)),this.setRTL(ba(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(xa.prototype,fa);const Sa=Phaser.Renderer.WebGL.Utils;var Ta={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _a=Phaser.Display.Color;var Pa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var v=d.cutX+a,p=d.cutY+h;return this.context.drawImage(d.source.image,v,p,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _a);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},ka={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const wa=Phaser.Display.Canvas.CanvasPool,Ea=Phaser.GameObjects.GameObject,Oa=Phaser.Utils.String.UUID;class Ma extends Ea{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=wa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){wa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Da=Phaser.GameObjects.Components;Phaser.Class.mixin(Ma,[Da.Alpha,Da.BlendMode,Da.Crop,Da.Depth,Da.Flip,Da.GetBounds,Da.Mask,Da.Origin,Da.Pipeline,Da.PostPipeline,Da.ScrollFactor,Da.Tint,Da.Transform,Da.Visible,Ta,Pa,ka]);const Ra=Phaser.Math.Linear,La=Phaser.Math.Percent;var za={setValue(t,e,i){return null==t||(void 0!==e&&(t=La(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=La(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Ra(t,e,i)),i}};const Aa=Phaser.Math.Percent;var Fa={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Aa(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Ia=Phaser.Utils.Objects.GetValue,Xa=Phaser.Math.Clamp;function Ya(t){class e extends t{bootProgressBase(t){this.eventEmitter=Ia(t,"eventEmitter",this);var e=Ia(t,"valuechangeCallback",null);if(null!==e){var i=Ia(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Ia(t,"easeValue.duration",0)).setEaseValueFunction(Ia(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Xa(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,za,Fa),e}const Va=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Va(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Na=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Na(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ba=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var h;return r>=0?((h=n[0]).x=t+r,h.y=e,(h=n[1]).x=i+r,h.y=e,(h=n[2]).x=i,h.y=s,(h=n[3]).x=t,h.y=s):((h=n[0]).x=t,h.y=e,(h=n[1]).x=i,h.y=e,(h=n[2]).x=i-r,h.y=s,(h=n[3]).x=t-r,h.y=s),n};const Ua=Phaser.Utils.Objects.GetValue,Ga=Phaser.Utils.Objects.IsPlainObject;class Ha extends(Ya(Ma)){constructor(t,e,i,s,r,n,a,h){Ga(e)?(e=Ua(h=e,"x",0),i=Ua(h,"y",0),s=Ua(h,"width",2),r=Ua(h,"height",2),n=Ua(h,"barColor",void 0),a=Ua(h,"value",0)):Ga(s)?(s=Ua(h=s,"width",2),r=Ua(h,"height",2),n=Ua(h,"barColor",void 0),a=Ua(h,"value",0)):Ga(n)&&(n=Ua(h=n,"barColor",void 0),a=Ua(h,"value",0)),super(t,e,i,s,r,Ua(h,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(h),this.setTrackColor(Ua(h,"trackColor",void 0)),this.setBarColor(n,Ua(h,"barColor2",void 0),Ua(h,"isHorizontalGradient",void 0)),this.setTrackStroke(Ua(h,"trackStrokeThickness",2),Ua(h,"trackStrokeColor",void 0)),this.setSkewX(Ua(h,"skewX",0)),this.setRTL(Ua(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Wa.call(this)}),this),this}}var Ja=function(t,e,i,s,r,n,a,h,o,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=h&&(e.strokeStyle=h,e.lineWidth=o,e.stroke())};const $a=Phaser.Math.PI2;var qa=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,h=this.startAngle,o=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),Ja(0,n,e,e,s,s,void 0,this.trackColor,i,h,o,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?o:a?(h-l*this.value+$a)%$a:(h+l*this.value)%$a,n.save(),this.barColor2){var u=e+s*Math.cos(h),v=e+s*Math.sin(h),p=e+s*Math.cos(d),g=e+s*Math.sin(d),f=n.createLinearGradient(u,v,p,g);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;Ja(0,n,e,e,s,s,void 0,c,i,h,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),Ja(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,h,o,l,d){void 0===o&&null!=h&&(o=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=h,e.lineWidth=o,e.lineCap="round",e.lineJoin="round",null!=h&&"none"!==h&&o>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const Za=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.IsPlainObject,Qa=Phaser.Math.Clamp,th=Phaser.Math.DegToRad(270),eh=Phaser.Math.PI2;class ih extends(Ya(Ma)){constructor(t,e,i,s,r,n,a){Ka(e)&&(e=Za(a=e,"x",0),i=Za(a,"y",0),s=Za(a,"radius",1),r=Za(a,"barColor",void 0),n=Za(a,"value",0));var h=2*s;super(t,e,i,h,h,Za(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Za(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(Za(a,"barColor2",void 0)),this.setCenterColor(Za(a,"centerColor",void 0)),this.setThickness(Za(a,"thickness",.2)),this.setStartAngle(Za(a,"startAngle",th)),this.setEndAngle(Za(a,"endAngle",this.startAngle+eh)),this.setAnticlockwise(Za(a,"anticlockwise",!1)),this.setTextColor(Za(a,"textColor",void 0)),this.setTextStrokeColor(Za(a,"textStrokeColor",void 0),Za(a,"textStrokeThickness",void 0));var o=Za(a,"textFont",void 0);o?this.setTextFont(o):this.setTextFont(Za(a,"textSize","16px"),Za(a,"textFamily","Courier"),Za(a,"textStyle","")),this.setTextFormatCallback(Za(a,"textFormatCallback",void 0),Za(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Qa(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),qa.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var sh=function(t,e,i){return i?t<=e?eh+t-e:t-e:t>=e?eh+e-t:e-t},rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const nh=Phaser.GameObjects.Graphics;class ah extends nh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=hh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,rh.call(this,this.width,this.height,this.padding,t,e)),this}}const hh={rectangle:0,circle:1};var oh=function(t,e,i,s){var r=new ah(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Utils.Objects.IsPlainObject;var ch=function(t,e){var i=lh(e,"background",void 0),s=lh(e,"icon",void 0),r=lh(e,"iconMask",void 0),n=lh(e,"nameText",void 0),a=lh(e,"valueText",void 0),h=lh(e,"bar",void 0),o=lh(e,"action",void 0),l=lh(e,"actionMask",void 0),d="line"===lh(e,"barShape","line");dh(h)&&(h=new(d?Ha:ih)(t,h),t.add.existing(h),n&&t.children.moveBelow(h,n),a&&t.children.moveBelow(h,a));var c=n||a||h;if(i&&this.addBackground(i),s){var u=void 0;0===this.orientation?(c||o)&&(u={right:lh(e,"space.icon",0),top:lh(e,"space.iconTop",0),bottom:lh(e,"space.iconBottom",0)}):(c||o)&&(u={bottom:lh(e,"space.icon",0),left:lh(e,"space.iconLeft",0),right:lh(e,"space.iconRight",0)}),this.add(s,{proportion:0,padding:u}),r&&(r=oh.call(this,s,s,1))}if(c){var v,p=new xa(t,{orientation:1});if(n||a){if(v=new xa(t,{orientation:0}),n){""===n.text&&n.setText(" "),n.setOrigin(0,n.originY);var u={left:lh(e,"space.name",0)};v.add(n,{padding:u})}a&&(""===a.text&&a.setText(" "),a.setOrigin(1,a.originY),v.addSpace(),u={right:lh(e,"space.value",0)},v.add(a,{padding:u}),this.setValueTextFormatCallback(lh(e,"valueTextFormatCallback",uh),lh(e,"valueTextFormatCallbackScope",void 0))),p.add(v,{expand:!0})}if(h)if(d){var g=v?lh(e,"space.bar"):0;void 0===g&&(g=lh(e,"space.barTop",0)),u={top:g,bottom:lh(e,"space.barBottom",0),left:lh(e,"space.barLeft",0),right:lh(e,"space.barRight",0)},p.add(h,{expand:!0,padding:u})}else u={top:lh(e,"space.barTop",0),bottom:lh(e,"space.barBottom",0),left:lh(e,"space.barLeft",0),right:lh(e,"space.barRight",0)},this.addBackground(h,u);u=void 0,o&&(u={right:lh(e,"space.text",0)});var f=lh(e,"align.text","bottom");this.add(p,{proportion:1,align:f,padding:u})}o&&(u=0===this.orientation?{top:lh(e,"space.actionTop",0),bottom:lh(e,"space.actionBottom",0)}:{left:lh(e,"space.actionLeft",0),right:lh(e,"space.actionRight",0)},this.add(o,{proportion:0,padding:u}),l&&(l=oh.call(this,o,o,1))),this.addChildrenMap("background",i),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("name",n),this.addChildrenMap("value",a),this.addChildrenMap("bar",h),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)},uh=function(t,e,i){return t.toString()};const vh=Phaser.Math.Clamp;var ph={setValueTextFormatCallback(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText(t,e,i){var s=this.childrenMap.value;return s&&this.valueTextFormatCallback&&(s.setText(this.getFormatValueText(t,e,i)),s.layout&&s.layout()),this},setValue(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,t=vh(t,e,i),this.value=t,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this},setEaseValueDuration(t){return this.easeValueDuration=t,this},easeValueTo(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,void 0===this.easeValueTask&&(this.easeValueTask=new ls(this),this.easeValueTask.on("update",(function(){this.setValue(this.value,this.minValue,this.maxValue)}),this)),this.easeValueTask.restart({key:"value",to:t,duration:this.easeValueDuration}),this}};class gh extends xa{constructor(t,e){super(t,e),this.type="rexNameValueLabel",ch.call(this,t,e),this.setEaseValueDuration(1e3)}get nameText(){var t=this.childrenMap.name;return void 0===t?"":t.text}set nameText(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t)}setNameText(t){return this.nameText=t,this}get valueText(){var t=this.childrenMap.value;return void 0===t?"":t.text}set valueText(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t)}setValueText(t){return this.valueText=t,this}get barValue(){var t=this.childrenMap.bar;if(void 0!==t)return t.value}set barValue(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t)}setBarValue(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.setValue(t,e,i),this}easeBarValueTo(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.easeValueTo(t,e,i),this}setTexture(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}get texture(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}get frame(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}return Object.assign(gh.prototype,ph),gh},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexnamevaluelabel=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var w={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=_(t.scaleX,i.scaleX),e.scaleY=_(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},O={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=_(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const V=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=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};const Pe=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Oe={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case ui:case pi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===vi}get isRunning(){return this.state===ui||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,vi=2,pi=3,gi=-1;class fi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class bi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;class _i extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(xi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new _i(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new _i(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Oi=function(t){return Ei(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Oi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Oi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Oi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new _i(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Oi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Fi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Vi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Oi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Oi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Oi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Hi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Oi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Oi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Oi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Oi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Oi(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Os={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Ft),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Ft),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Os,Ms,Ds,Rs);const zs=Phaser.Utils.Objects.GetValue;class As extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ls);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Is extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Ys extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const br=Phaser.Utils.Objects.GetValue;class xr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=br(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class kr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Or=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class vn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=pn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=pn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,on);const pn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,bn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case _n:this.tracerState=Tn,this.onDrag1End();break;case Pn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(xn.prototype,Be);var Sn={};const Tn=0,_n=1,Pn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},On={};const Mn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=On),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Ln(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Xn}break;case Xn:t=Dn(Ln(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Xn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const Fn="IDLE",In="BEGIN",Xn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Rr.call(t,e),Ar.call(t,e),Xr.call(t,e),Nr.call(t,e),Vn.call(t,e),Nn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Ot(t)},getChildPrevState:function(t){var e=Ot(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),v=0,p=u.length;v(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=na[e];else if(ia(e)){var p;e=sa(p=e,"proportion",void 0),i=sa(p,"align",ra),s=sa(p,"padding",0),r=sa(p,"expand",!1),n=sa(p,"key",void 0),a=sa(p,"index",void 0),t.isRexSizer||(h=sa(p,"minWidth",void 0),o=sa(p,"minHeight",void 0)),l=sa(p,"fitRatio",0),d=sa(p,"offsetX",0),c=sa(p,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(p=this.getSizerConfig(t)).proportion=e,p.align=i,p.padding=ce(s),p.expand=r,p.fitRatio=0===e?l:0,p.alignOffsetX=d,p.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ua={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,v=this.innerWidth,p=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(fa,ha,ca,ua,va,pa,ga);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,ba=Phaser.Utils.Objects.GetValue;class xa extends $n{constructor(t,e,i,s,r,n,a){Ca(e)?(e=ba(a=e,"x",0),i=ba(a,"y",0),s=ba(a,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(s)?(s=ba(a=s,"width",void 0),r=ba(a,"height",void 0),n=ba(a,"orientation",0)):Ca(n)&&(n=ba(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(ba(a,"space.item",0)),this.setStartChildIndex(ba(a,"startChildIndex",0)),this.setRTL(ba(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(xa.prototype,fa);const Sa=Phaser.Renderer.WebGL.Utils;var Ta={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const _a=Phaser.Display.Color;var Pa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var v=d.cutX+a,p=d.cutY+h;return this.context.drawImage(d.source.image,v,p,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new _a);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},ka={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const wa=Phaser.Display.Canvas.CanvasPool,Ea=Phaser.GameObjects.GameObject,Oa=Phaser.Utils.String.UUID;class Ma extends Ea{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=wa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Oa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){wa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Da=Phaser.GameObjects.Components;Phaser.Class.mixin(Ma,[Da.Alpha,Da.BlendMode,Da.Crop,Da.Depth,Da.Flip,Da.GetBounds,Da.Mask,Da.Origin,Da.Pipeline,Da.PostPipeline,Da.ScrollFactor,Da.Tint,Da.Transform,Da.Visible,Ta,Pa,ka]);const Ra=Phaser.Math.Linear,La=Phaser.Math.Percent;var za={setValue(t,e,i){return null==t||(void 0!==e&&(t=La(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=La(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Ra(t,e,i)),i}};const Aa=Phaser.Math.Percent;var Fa={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Aa(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new ls(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Ia=Phaser.Utils.Objects.GetValue,Xa=Phaser.Math.Clamp;function Ya(t){class e extends t{bootProgressBase(t){this.eventEmitter=Ia(t,"eventEmitter",this);var e=Ia(t,"valuechangeCallback",null);if(null!==e){var i=Ia(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Ia(t,"easeValue.duration",0)).setEaseValueFunction(Ia(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Xa(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,za,Fa),e}const Va=Phaser.Utils.String.Pad;var ja=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Va(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Na=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Na(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ba=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var h;return r>=0?((h=n[0]).x=t+r,h.y=e,(h=n[1]).x=i+r,h.y=e,(h=n[2]).x=i,h.y=s,(h=n[3]).x=t,h.y=s):((h=n[0]).x=t,h.y=e,(h=n[1]).x=i,h.y=e,(h=n[2]).x=i-r,h.y=s,(h=n[3]).x=t-r,h.y=s),n};const Ua=Phaser.Utils.Objects.GetValue,Ga=Phaser.Utils.Objects.IsPlainObject;class Ha extends(Ya(Ma)){constructor(t,e,i,s,r,n,a,h){Ga(e)?(e=Ua(h=e,"x",0),i=Ua(h,"y",0),s=Ua(h,"width",2),r=Ua(h,"height",2),n=Ua(h,"barColor",void 0),a=Ua(h,"value",0)):Ga(s)?(s=Ua(h=s,"width",2),r=Ua(h,"height",2),n=Ua(h,"barColor",void 0),a=Ua(h,"value",0)):Ga(n)&&(n=Ua(h=n,"barColor",void 0),a=Ua(h,"value",0)),super(t,e,i,s,r,Ua(h,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(h),this.setTrackColor(Ua(h,"trackColor",void 0)),this.setBarColor(n,Ua(h,"barColor2",void 0),Ua(h,"isHorizontalGradient",void 0)),this.setTrackStroke(Ua(h,"trackStrokeThickness",2),Ua(h,"trackStrokeColor",void 0)),this.setSkewX(Ua(h,"skewX",0)),this.setRTL(Ua(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Wa.call(this)}),this),this}}var Ja=function(t,e,i,s,r,n,a,h,o,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=h&&(e.strokeStyle=h,e.lineWidth=o,e.stroke())};const $a=Phaser.Math.PI2;var qa=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,h=this.startAngle,o=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),Ja(0,n,e,e,s,s,void 0,this.trackColor,i,h,o,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?o:a?(h-l*this.value+$a)%$a:(h+l*this.value)%$a,n.save(),this.barColor2){var u=e+s*Math.cos(h),v=e+s*Math.sin(h),p=e+s*Math.cos(d),g=e+s*Math.sin(d),f=n.createLinearGradient(u,v,p,g);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;Ja(0,n,e,e,s,s,void 0,c,i,h,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),Ja(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,h,o,l,d){void 0===o&&null!=h&&(o=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=h,e.lineWidth=o,e.lineCap="round",e.lineJoin="round",null!=h&&"none"!==h&&o>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const Za=Phaser.Utils.Objects.GetValue,Ka=Phaser.Utils.Objects.IsPlainObject,Qa=Phaser.Math.Clamp,th=Phaser.Math.DegToRad(270),eh=Phaser.Math.PI2;class ih extends(Ya(Ma)){constructor(t,e,i,s,r,n,a){Ka(e)&&(e=Za(a=e,"x",0),i=Za(a,"y",0),s=Za(a,"radius",1),r=Za(a,"barColor",void 0),n=Za(a,"value",0));var h=2*s;super(t,e,i,h,h,Za(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Za(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(Za(a,"barColor2",void 0)),this.setCenterColor(Za(a,"centerColor",void 0)),this.setThickness(Za(a,"thickness",.2)),this.setStartAngle(Za(a,"startAngle",th)),this.setEndAngle(Za(a,"endAngle",this.startAngle+eh)),this.setAnticlockwise(Za(a,"anticlockwise",!1)),this.setTextColor(Za(a,"textColor",void 0)),this.setTextStrokeColor(Za(a,"textStrokeColor",void 0),Za(a,"textStrokeThickness",void 0));var o=Za(a,"textFont",void 0);o?this.setTextFont(o):this.setTextFont(Za(a,"textSize","16px"),Za(a,"textFamily","Courier"),Za(a,"textStyle","")),this.setTextFormatCallback(Za(a,"textFormatCallback",void 0),Za(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=sh(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Qa(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=ja(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),qa.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var sh=function(t,e,i){return i?t<=e?eh+t-e:t-e:t>=e?eh+e-t:e-t},rh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const nh=Phaser.GameObjects.Graphics;class ah extends nh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=hh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,rh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,rh.call(this,this.width,this.height,this.padding,t,e)),this}}const hh={rectangle:0,circle:1};var oh=function(t,e,i,s){var r=new ah(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Utils.Objects.IsPlainObject;var ch=function(t,e){var i=lh(e,"background",void 0),s=lh(e,"icon",void 0),r=lh(e,"iconMask",void 0),n=lh(e,"nameText",void 0),a=lh(e,"valueText",void 0),h=lh(e,"bar",void 0),o=lh(e,"action",void 0),l=lh(e,"actionMask",void 0),d="line"===lh(e,"barShape","line");dh(h)&&(h=new(d?Ha:ih)(t,h),t.add.existing(h),n&&t.children.moveBelow(h,n),a&&t.children.moveBelow(h,a));var c=n||a||h;if(i&&this.addBackground(i),s){var u=void 0;0===this.orientation?(c||o)&&(u={right:lh(e,"space.icon",0),top:lh(e,"space.iconTop",0),bottom:lh(e,"space.iconBottom",0)}):(c||o)&&(u={bottom:lh(e,"space.icon",0),left:lh(e,"space.iconLeft",0),right:lh(e,"space.iconRight",0)}),this.add(s,{proportion:0,padding:u}),r&&(r=oh.call(this,s,s,1))}if(c){var v,p=new xa(t,{orientation:1});if(n||a){if(v=new xa(t,{orientation:0}),n){""===n.text&&n.setText(" "),n.setOrigin(0,n.originY);var u={left:lh(e,"space.name",0)};v.add(n,{padding:u})}a&&(""===a.text&&a.setText(" "),a.setOrigin(1,a.originY),v.addSpace(),u={right:lh(e,"space.value",0)},v.add(a,{padding:u}),this.setValueTextFormatCallback(lh(e,"valueTextFormatCallback",uh),lh(e,"valueTextFormatCallbackScope",void 0))),p.add(v,{expand:!0})}if(h)if(d){var g=v?lh(e,"space.bar"):0;void 0===g&&(g=lh(e,"space.barTop",0)),u={top:g,bottom:lh(e,"space.barBottom",0),left:lh(e,"space.barLeft",0),right:lh(e,"space.barRight",0)},p.add(h,{expand:!0,padding:u})}else u={top:lh(e,"space.barTop",0),bottom:lh(e,"space.barBottom",0),left:lh(e,"space.barLeft",0),right:lh(e,"space.barRight",0)},this.addBackground(h,u);u=void 0,o&&(u={right:lh(e,"space.text",0)});var f=lh(e,"align.text","bottom");this.add(p,{proportion:1,align:f,padding:u})}o&&(u=0===this.orientation?{top:lh(e,"space.actionTop",0),bottom:lh(e,"space.actionBottom",0)}:{left:lh(e,"space.actionLeft",0),right:lh(e,"space.actionRight",0)},this.add(o,{proportion:0,padding:u}),l&&(l=oh.call(this,o,o,1))),this.addChildrenMap("background",i),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("name",n),this.addChildrenMap("value",a),this.addChildrenMap("bar",h),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)},uh=function(t,e,i){return t.toString()};const vh=Phaser.Math.Clamp;var ph={setValueTextFormatCallback(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText(t,e,i){var s=this.childrenMap.value;return s&&this.valueTextFormatCallback&&(s.setText(this.getFormatValueText(t,e,i)),s.layout&&s.layout()),this},setValue(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,t=vh(t,e,i),this.value=t,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this},setEaseValueDuration(t){return this.easeValueDuration=t,this},easeValueTo(t,e,i){return void 0===e?e=this.minValue:this.minValue=e,void 0===i?i=this.maxValue:this.maxValue=i,void 0===this.easeValueTask&&(this.easeValueTask=new ls(this),this.easeValueTask.on("update",(function(){this.setValue(this.value,this.minValue,this.maxValue)}),this)),this.easeValueTask.restart({key:"value",to:t,duration:this.easeValueDuration}),this}};class gh extends xa{constructor(t,e){super(t,e),this.type="rexNameValueLabel",ch.call(this,t,e),this.setEaseValueDuration(1e3)}get nameText(){var t=this.childrenMap.name;return void 0===t?"":t.text}set nameText(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t)}setNameText(t){return this.nameText=t,this}get valueText(){var t=this.childrenMap.value;return void 0===t?"":t.text}set valueText(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t)}setValueText(t){return this.valueText=t,this}get barValue(){var t=this.childrenMap.bar;if(void 0!==t)return t.value}set barValue(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t)}setBarValue(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.setValue(t,e,i),this}easeBarValueTo(t,e,i){var s=this.childrenMap.bar;return void 0===s||s.easeValueTo(t,e,i),this}setTexture(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}get texture(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}get frame(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}return Object.assign(gh.prototype,ph),gh},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexnamevaluelabel=e(); diff --git a/dist/rexnumberbar.js b/dist/rexnumberbar.js index f6cb4da8c7..c055e3f926 100644 --- a/dist/rexnumberbar.js +++ b/dist/rexnumberbar.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$d(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$d(config, 'offsetX', 0); + offsetY = GetValue$d(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexnumberbar.min.js b/dist/rexnumberbar.min.js index 670f16518f..e0bc32f7d2 100644 --- a/dist/rexnumberbar.min.js +++ b/dist/rexnumberbar.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case fi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,fi=3,gi=-1;class mi extends hi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class _i extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let wi=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Wi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Vi),Bi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ji extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ji&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ji(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ji&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ji(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ds,Ms,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Fs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class Is extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Gs extends Is{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Js=function(t,e){Ni(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Hs)),this.setCoverTransitOutCallback(qs(i,"transitOut",Js)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),a=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?$s(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new fr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const _r=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Ur=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,Ke(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const cn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=fn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=fn)}get isSwiped(){return this.state===mn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const fn="IDLE",gn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=On,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case wn:this.tracerState=xn,this.onDrag1End();break;case On:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ge);var Pn={};const xn=0,wn=1,On=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},Dn={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(An(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Yn}break;case Yn:t=Rn(An(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Yn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Xn="IDLE",Fn="BEGIN",Yn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Yr.call(t,e),Vr.call(t,e),Nn.call(t,e),Vn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",le),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(a=he(o,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l){ve.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=aa[e];else if(sa(e)){var c;e=ra(c=e,"proportion",void 0),i=ra(c,"align",na),s=ra(c,"padding",0),r=ra(c,"expand",!1),n=ra(c,"key",void 0),a=ra(c,"index",void 0),t.isRexSizer||(h=ra(c,"minWidth",void 0),o=ra(c,"minHeight",void 0)),l=ra(c,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ce(s),c.expand=r,c.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Tt.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ma={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ma,oa,ca,pa,va,fa,ga);var ya=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ba={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){Ca(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ba[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,ma);var Pa=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},xa=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const wa=Phaser.GameObjects.Graphics;class Oa extends wa{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!xa(this.padding,i);return r||n?(this.width=t,this.height=e,n&>(i,this.padding),this.originX=s.originX,this.originY=s.originY,Pa.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Pa.call(this,this.width,this.height,this.padding,t,e)),this}}const Ea={rectangle:0,circle:1};var Ta=function(t,e,i,s){var r=new Oa(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r},ka=Phaser.Renderer.WebGL.Utils,Da=function(t,e,i,s,r,n){for(var a=ka.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},ja=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const za=Phaser.Renderer.Canvas.SetTransform;var Xa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=La(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Da(r,a,e,l,h,o),e.isStroked&&Ra(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(za(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ya.prototype,Xa);const Ia=Phaser.Utils.Objects.GetValue;let Na=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ia(t,"x",0),i=Ia(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Ia(t,"tl",void 0),e,i),s.tr=Wa(Ia(t,"tr",void 0),e,i),s.bl=Wa(Ia(t,"bl",void 0),e,i),s.br=Wa(Ia(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Va(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Va(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Va(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Va(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ba(t),t},Va=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ia(e,"x",0),t.y=Ia(e,"y",0)),Ba(t)},Ba=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ga=function(t){return t.x>0&&t.y>0},Ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ha=Phaser.Math.DegToRad;var Ja=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Jh=Phaser.Utils.Objects.GetValue,$h=Phaser.Utils.Objects.IsPlainObject;class qh extends(Ch(ch)){constructor(t,e,i,s,r,n,a,h){$h(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):$h(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):$h(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Uh).setName("trackFill")).addShape((new Uh).setName("bar")).addShape((new Uh).setName("trackStroke")),this.setTrackColor(Jh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Jh(h,"trackStrokeThickness",2),Jh(h,"trackStrokeColor",void 0)),this.setSkewX(Jh(h,"skewX",0)),this.setRTL(Jh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Kh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Hh(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Hh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Hh(h,0,0,e,i,t)}};Object.assign(qh.prototype,Kh);var Zh=function(t){return null==t||""===t||0===t.length},Qh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Zh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Zh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nyo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}const bo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;var _o=function(t){return"string"==typeof t&&(t=So[t]),t};const So={scale:0,repeat:1};var Po=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},xo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=mo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var x=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return bo(t)?(this.stretchMode.edge=_o(Co(t,"edge",0)),this.stretchMode.internal=_o(Co(t,"internal",0))):(t=_o(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Po.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const wo=Phaser.Utils.Objects.IsPlainObject,Oo=Phaser.Utils.Objects.GetValue,Eo=Phaser.GameObjects;var To=void 0,ko=function(t,e){if(To||(To={},Ke(t).events.once("destroy",(function(){for(var t in To)To[t].destroy();To=void 0}))),!To.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Eo[e](i)).setOrigin(0),To[e]=t}return To[e]};const Do=Phaser.GameObjects.RenderTexture;class Mo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(wo(i)?(i=Oo(d=i,"x",0),s=Oo(d,"y",0),r=Oo(d,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(r)?(r=Oo(d=r,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(a)?(a=Oo(d=a,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(h)?(h=Oo(d=h,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Oo(d,"baseFrame",void 0)):wo(o)&&(o=Oo(d=o,"columns",void 0),l=Oo(d,"rows",void 0)),void 0===h&&(h=Oo(d,"frame",void 0)),void 0===o){var u=Oo(d,"leftWidth",void 0),c=Oo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=Oo(d,"topHeight",void 0),v=Oo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Oo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Oo(d,"stretchMode",0)),this.setPreserveRatio(Oo(d,"preserveRatio",!0));var f=Oo(d,"maxFixedPartScale",1),g=Oo(d,"maxFixedPartScaleX",f),m=Oo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,xo),i}(Do,"rexNinePatch")){}var Ro={_drawImage:function(t,e,i,s,r,n){var a=ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Mo.prototype,Ro);class Lo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(io(t,e))return t[e];var i=t.parent;return io(i,e)?i[e]:void 0}set(t,e,i){return io(t,e)?t[e]=i:io(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Ao=Phaser.Utils.Objects.GetValue;class jo extends Mo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ao(e,"effects",!0);i&&ho(this,i),this.style=new Lo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jo.prototype,rh);const zo=["alpha","tint","flipX","flipY"];var Xo=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new to(t,e);break;case"image":s=new go(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new jo(t,e):new co(t,e);break;default:s=new nh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=zo.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case fi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,fi=3,gi=-1;class mi extends hi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class _i extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let wi=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Wi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Vi),Bi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ji extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ji&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ji(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ji&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ji(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ds,Ms,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Fs extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class Is extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Gs extends Is{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Js=function(t,e){Ni(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Hs)),this.setCoverTransitOutCallback(qs(i,"transitOut",Js)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),a=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?$s(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new fr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const _r=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Ur=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,Ke(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const cn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=fn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=fn)}get isSwiped(){return this.state===mn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const fn="IDLE",gn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=On,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case wn:this.tracerState=xn,this.onDrag1End();break;case On:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ge);var Pn={};const xn=0,wn=1,On=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},Dn={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(An(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Yn}break;case Yn:t=Rn(An(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Yn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Xn="IDLE",Fn="BEGIN",Yn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Yr.call(t,e),Vr.call(t,e),Nn.call(t,e),Vn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",le),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(a=he(o,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l,d,u){ve.call(this,t);var c=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=aa[e];else if(sa(e)){var v;e=ra(v=e,"proportion",void 0),i=ra(v,"align",na),s=ra(v,"padding",0),r=ra(v,"expand",!1),n=ra(v,"key",void 0),a=ra(v,"index",void 0),t.isRexSizer||(h=ra(v,"minWidth",void 0),o=ra(v,"minHeight",void 0)),l=ra(v,"fitRatio",0),d=ra(v,"offsetX",0),u=ra(v,"offsetY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(c?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=u,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Tt.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ma={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ma,oa,ca,pa,va,fa,ga);var ya=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ba={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){Ca(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ba[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,ma);var Pa=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},xa=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const wa=Phaser.GameObjects.Graphics;class Oa extends wa{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!xa(this.padding,i);return r||n?(this.width=t,this.height=e,n&>(i,this.padding),this.originX=s.originX,this.originY=s.originY,Pa.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Pa.call(this,this.width,this.height,this.padding,t,e)),this}}const Ea={rectangle:0,circle:1};var Ta=function(t,e,i,s){var r=new Oa(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r},ka=Phaser.Renderer.WebGL.Utils,Da=function(t,e,i,s,r,n){for(var a=ka.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},ja=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const za=Phaser.Renderer.Canvas.SetTransform;var Xa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=La(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Da(r,a,e,l,h,o),e.isStroked&&Ra(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(za(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ya.prototype,Xa);const Ia=Phaser.Utils.Objects.GetValue;let Na=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ia(t,"x",0),i=Ia(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Ia(t,"tl",void 0),e,i),s.tr=Wa(Ia(t,"tr",void 0),e,i),s.bl=Wa(Ia(t,"bl",void 0),e,i),s.br=Wa(Ia(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Va(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Va(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Va(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Va(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ba(t),t},Va=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ia(e,"x",0),t.y=Ia(e,"y",0)),Ba(t)},Ba=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ga=function(t){return t.x>0&&t.y>0},Ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ha=Phaser.Math.DegToRad;var Ja=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Jh=Phaser.Utils.Objects.GetValue,$h=Phaser.Utils.Objects.IsPlainObject;class qh extends(Ch(ch)){constructor(t,e,i,s,r,n,a,h){$h(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):$h(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):$h(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Uh).setName("trackFill")).addShape((new Uh).setName("bar")).addShape((new Uh).setName("trackStroke")),this.setTrackColor(Jh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Jh(h,"trackStrokeThickness",2),Jh(h,"trackStrokeColor",void 0)),this.setSkewX(Jh(h,"skewX",0)),this.setRTL(Jh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Kh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Hh(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Hh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Hh(h,0,0,e,i,t)}};Object.assign(qh.prototype,Kh);var Zh=function(t){return null==t||""===t||0===t.length},Qh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Zh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Zh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nyo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yo(t[i]));return e}const bo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;var _o=function(t){return"string"==typeof t&&(t=So[t]),t};const So={scale:0,repeat:1};var Po=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},xo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=mo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yo(i),s=yo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var x=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return bo(t)?(this.stretchMode.edge=_o(Co(t,"edge",0)),this.stretchMode.internal=_o(Co(t,"internal",0))):(t=_o(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Po.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const wo=Phaser.Utils.Objects.IsPlainObject,Oo=Phaser.Utils.Objects.GetValue,Eo=Phaser.GameObjects;var To=void 0,ko=function(t,e){if(To||(To={},Ke(t).events.once("destroy",(function(){for(var t in To)To[t].destroy();To=void 0}))),!To.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Eo[e](i)).setOrigin(0),To[e]=t}return To[e]};const Do=Phaser.GameObjects.RenderTexture;class Mo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(wo(i)?(i=Oo(d=i,"x",0),s=Oo(d,"y",0),r=Oo(d,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(r)?(r=Oo(d=r,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(a)?(a=Oo(d=a,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(h)?(h=Oo(d=h,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Oo(d,"baseFrame",void 0)):wo(o)&&(o=Oo(d=o,"columns",void 0),l=Oo(d,"rows",void 0)),void 0===h&&(h=Oo(d,"frame",void 0)),void 0===o){var u=Oo(d,"leftWidth",void 0),c=Oo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=Oo(d,"topHeight",void 0),v=Oo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Oo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Oo(d,"stretchMode",0)),this.setPreserveRatio(Oo(d,"preserveRatio",!0));var f=Oo(d,"maxFixedPartScale",1),g=Oo(d,"maxFixedPartScaleX",f),m=Oo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,xo),i}(Do,"rexNinePatch")){}var Ro={_drawImage:function(t,e,i,s,r,n){var a=ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Mo.prototype,Ro);class Lo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(io(t,e))return t[e];var i=t.parent;return io(i,e)?i[e]:void 0}set(t,e,i){return io(t,e)?t[e]=i:io(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Ao=Phaser.Utils.Objects.GetValue;class jo extends Mo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ao(e,"effects",!0);i&&ho(this,i),this.style=new Lo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jo.prototype,rh);const zo=["alpha","tint","flipX","flipY"];var Xo=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new to(t,e);break;case"image":s=new go(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new jo(t,e):new co(t,e);break;default:s=new nh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=zo.length;i= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexscrollablepanel.min.js b/dist/rexscrollablepanel.min.js index aafba6c898..f144cd88f2 100644 --- a/dist/rexscrollablepanel.min.js +++ b/dist/rexscrollablepanel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},T={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const Ee=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Oi=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ni),Gi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Hi=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Hi(t,"x",void 0),i=Hi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Hi(i,"startX",void 0),this.startY=Hi(i,"startY",void 0),this.endX=Hi(i,"endX",void 0),this.endY=Hi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const qi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ys={};Object.assign(Ys,Ds,Rs,Ls,Xs);const zs=Phaser.Utils.Objects.GetValue;class As extends ti{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ys);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?js(e):t};class Is extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Bs extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Js=function(t,e){Vi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Zs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",Js)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const mr={press:0,pointerdown:0,release:1,pointerup:1};var yr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new fr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?br:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class kr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Hr=0,$r=1,Jr="IDLE",qr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Zr extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Qr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(qr(t,"time",250)),this.setTapInterval(qr(t,"tapInterval",200)),this.setDragThreshold(qr(t,"threshold",9)),this.setTapOffset(qr(t,"tapOffset",10));var e=qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(qr(t,"maxTaps",void 0)),this.setMinTaps(qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Qr:this.state=tn;break;case tn:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=en,this.state=tn);break;case en:this.state=tn}}onDragEnd(){this.state===tn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=en))}onDrag(){this.state!==Qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===tn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=en:this.state=Qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===en&&(this.state=Qr)}get isTapped(){return this.state===en}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Qr="IDLE",tn="BEGIN",en="RECOGNIZED",sn=Phaser.Utils.Objects.GetValue;class rn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=nn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(sn(t,"threshold",9)),this.setHoldTime(sn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=nn}onDrag(){this.state!==nn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=nn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const nn="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ze(t).loop.delta};const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case kn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(xn.prototype,Ue);var _n={};const On=0,En=1,kn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Wn="BEGIN",Fn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new rn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},Xr.call(t,e),Ar.call(t,e),Wr.call(t,e),Nr.call(t,e),Bn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(nh(e)){var u;e=hh(u=e,"proportion",void 0),i=hh(u,"align",ah),s=hh(u,"padding",0),r=hh(u,"expand",!1),n=hh(u,"key",void 0),h=hh(u,"index",void 0),t.isRexSizer||(a=hh(u,"minWidth",void 0),o=hh(u,"minHeight",void 0)),l=hh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Tt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h){Ph(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(xh.prototype,bh);var _h={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Eh(t));var i=t[e];return"string"==typeof i&&(i=_h[i]),i},Eh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},kh=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Display.Align.CENTER;var Lh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Yh(this.sizerChildren,null),uh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Yh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Bh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends Zn{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Gh(l=e,"x",0),i=Gh(l,"y",0),s=Gh(l,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(s)?(s=Gh(l=s,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(a)&&(a=Gh(l=a,"columnProportions",0),o=Gh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Gh(l,"createCellContainerCallback")),this.setIndentLeft(Gh(l,"space.indentLeftOdd",0),Gh(l,"space.indentLeftEven",0)),this.setIndentTop(Gh(l,"space.indentTopOdd",0),Gh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Gh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Bh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Uh.prototype,Fh);const Hh=Phaser.Utils.Objects.GetValue;var $h=Phaser.Renderer.WebGL.Utils,Jh=function(t,e,i,s,r,n){for(var h=$h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ta=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ea=Phaser.Renderer.Canvas.SetTransform;var ia={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Jh(r,h,e,l,a,o),e.isStroked&&Kh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ea(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ra.prototype,ia);const na=Phaser.Utils.Objects.GetValue;let ha=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=na(t,"x",0),i=na(t,"y",0));var s=this.cornerRadius;s.tl=aa(na(t,"tl",void 0),e,i),s.tr=aa(na(t,"tr",void 0),e,i),s.bl=aa(na(t,"bl",void 0),e,i),s.br=aa(na(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oa(this.cornerRadius.br,t)}};var aa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),la(t),t},oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=na(e,"x",0),t.y=na(e,"y",0)),la(t)},la=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},da=function(t){return t.x>0&&t.y>0},ca=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ua=Phaser.Math.DegToRad;var pa=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const go=Phaser.Utils.Objects.GetValue,fo=Phaser.Utils.Objects.IsPlainObject;class mo extends(Wa(Ra)){constructor(t,e,i,s,r,n,h,a){fo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):fo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):fo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new po).setName("trackFill")).addShape((new po).setName("bar")).addShape((new po).setName("trackStroke")),this.setTrackColor(go(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(go(a,"trackStrokeThickness",2),go(a,"trackStrokeColor",void 0)),this.setSkewX(go(a,"skewX",0)),this.setRTL(go(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&vo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),vo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&vo(a,0,0,e,i,t)}};Object.assign(mo.prototype,yo);var bo=function(t){return null==t||""===t||0===t.length},Co=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(bo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(bo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;njo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=jo(t[i]));return e}const Io=Phaser.Utils.Objects.IsPlainObject,Wo=Phaser.Utils.Objects.GetValue;var Fo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Bo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},No={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ao),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=jo(i),s=jo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Io(t)?(this.stretchMode.edge=Fo(Wo(t,"edge",0)),this.stretchMode.internal=Fo(Wo(t,"internal",0))):(t=Fo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var $o=void 0,Jo=function(t,e){if($o||($o={},Ze(t).events.once("destroy",(function(){for(var t in $o)$o[t].destroy();$o=void 0}))),!$o.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),$o[e]=t}return $o[e]};const qo=Phaser.GameObjects.RenderTexture;class Ko extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Go(i)?(i=Uo(d=i,"x",0),s=Uo(d,"y",0),r=Uo(d,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(r)?(r=Uo(d=r,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(h)?(h=Uo(d=h,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(a)?(a=Uo(d=a,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Uo(d,"baseFrame",void 0)):Go(o)&&(o=Uo(d=o,"columns",void 0),l=Uo(d,"rows",void 0)),void 0===a&&(a=Uo(d,"frame",void 0)),void 0===o){var c=Uo(d,"leftWidth",void 0),u=Uo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Uo(d,"topHeight",void 0),v=Uo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Uo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Uo(d,"stretchMode",0)),this.setPreserveRatio(Uo(d,"preserveRatio",!0));var g=Uo(d,"maxFixedPartScale",1),f=Uo(d,"maxFixedPartScaleX",g),m=Uo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,No),i}(qo,"rexNinePatch")){}var Zo={_drawImage:function(t,e,i,s,r,n){var h=Jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ko.prototype,Zo);class Qo extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(wo(t,e))return t[e];var i=t.parent;return wo(i,e)?i[e]:void 0}set(t,e,i){return wo(t,e)?t[e]=i:wo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const tl=Phaser.Utils.Objects.GetValue;class el extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ko(this,i),this.style=new Qo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,xa);const il=["alpha","tint","flipX","flipY"];var sl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new So(t,e);break;case"image":s=new zo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ro(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=il.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class zl extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!hr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!hr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Al=Phaser.Utils.Objects.GetValue;class jl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Al(t,"value",0)),this.setSpeed(Al(t,"speed",0)),this.setAcceleration(Al(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Il{constructor(){this.value,this.dir,this.movement=new jl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Bl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Nl=Phaser.Utils.Objects.GetValue;class Gl extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Nl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Nl(e,"speed",.1)),this.setEnable(Nl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Nl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||hr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ul=Phaser.Utils.Objects.GetValue;var Hl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ul(s,l,void 0):Ul(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Ul(r,"position",0);"string"==typeof p&&(p=$l[p]);var v,g,f=Ul(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ul(s,"space.slider",void 0))&&(a?f=0:v=Ul(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ul(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ul(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ul(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ul(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ul(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ul(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Ul(s,C,!0):Ul(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new Gl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(P=h?"t":"s",x=`scroll${i}`):(P="t",x="scroll"),n.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),y&&(a?(w=`childO${i}`,x=`scroll${i}`):(w="childOY",x="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const $l={right:0,left:1,bottom:0,top:1},Jl={gameObject:0,rectBounds:1},ql=Phaser.Utils.Objects.GetValue;var Kl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ql(e,"width"),h=ql(e,"height");n||ql(e,"child.expandWidth",!0)||(s[1]=0),h||ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Uh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(t,a,"x",e)}return a},Zl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Od.prototype,Pd);const Ed=["top","bottom","centerY","center"],kd=["left","right","centerX","center"];var Td=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Ed.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=kd.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Md=Phaser.Utils.Objects.GetValue;class Dd extends rd{constructor(t,e){void 0===e&&(e={});var i=Oh(e),s=Md(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Md(e,"clampChildOY",!1),s.clampChildOX=Md(e,"clampChildOX",!1);var r,n,h=new Od(t,s);switch(t.add.existing(h),i){case 0:r=Md(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Md(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Md(e,"align.panel","center")};var a=Md(e,"space",void 0);a&&(a.child=Md(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Jn(this.childrenMap.child,t),this}}var Rd={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Td.call(this,t,"y",e);break;case 1:Td.call(this,t,"x",e);break;default:Td.call(this,t,"y",e),Td.call(this,t,"x",e)}return this}};return Object.assign(Dd.prototype,Rd),Dd},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexscrollablepanel=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},T={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const Ee=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Oi=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ni),Gi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Hi=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Hi(t,"x",void 0),i=Hi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Hi(i,"startX",void 0),this.startY=Hi(i,"startY",void 0),this.endX=Hi(i,"endX",void 0),this.endY=Hi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const qi={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ys={};Object.assign(Ys,Ds,Rs,Ls,Xs);const zs=Phaser.Utils.Objects.GetValue;class As extends ti{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Ys);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?js(e):t};class Is extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Bs extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Hs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Js=function(t,e){Vi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Zs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",Js)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const mr={press:0,pointerdown:0,release:1,pointerup:1};var yr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new fr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?br:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class kr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Hr=0,$r=1,Jr="IDLE",qr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Zr extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Qr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(qr(t,"time",250)),this.setTapInterval(qr(t,"tapInterval",200)),this.setDragThreshold(qr(t,"threshold",9)),this.setTapOffset(qr(t,"tapOffset",10));var e=qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(qr(t,"maxTaps",void 0)),this.setMinTaps(qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Qr:this.state=tn;break;case tn:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=en,this.state=tn);break;case en:this.state=tn}}onDragEnd(){this.state===tn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=en))}onDrag(){this.state!==Qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===tn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=en:this.state=Qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===en&&(this.state=Qr)}get isTapped(){return this.state===en}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Qr="IDLE",tn="BEGIN",en="RECOGNIZED",sn=Phaser.Utils.Objects.GetValue;class rn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=nn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(sn(t,"threshold",9)),this.setHoldTime(sn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=nn}onDrag(){this.state!==nn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=nn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const nn="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ze(t).loop.delta};const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case kn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(xn.prototype,Ue);var _n={};const On=0,En=1,kn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Wn="BEGIN",Fn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new rn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},Xr.call(t,e),Ar.call(t,e),Wr.call(t,e),Nr.call(t,e),Bn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l,d,c){ge.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=oh[e];else if(nh(e)){var v;e=hh(v=e,"proportion",void 0),i=hh(v,"align",ah),s=hh(v,"padding",0),r=hh(v,"expand",!1),n=hh(v,"key",void 0),h=hh(v,"index",void 0),t.isRexSizer||(a=hh(v,"minWidth",void 0),o=hh(v,"minHeight",void 0)),l=hh(v,"fitRatio",0),d=hh(v,"offsetX",0),c=hh(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=pe(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Tt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&eh.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(bh,dh,vh,gh,fh,mh,yh);var Ch=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h){Ph(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ch.call(this)),this._childrenProportion}}Object.assign(xh.prototype,bh);var _h={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Eh(t));var i=t[e];return"string"==typeof i&&(i=_h[i]),i},Eh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},kh=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Display.Align.CENTER;var Lh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Yh(this.sizerChildren,null),uh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Yh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Bh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends Zn{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Gh(l=e,"x",0),i=Gh(l,"y",0),s=Gh(l,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(s)?(s=Gh(l=s,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(a)&&(a=Gh(l=a,"columnProportions",0),o=Gh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Gh(l,"createCellContainerCallback")),this.setIndentLeft(Gh(l,"space.indentLeftOdd",0),Gh(l,"space.indentLeftEven",0)),this.setIndentTop(Gh(l,"space.indentTopOdd",0),Gh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Gh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Bh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Uh.prototype,Fh);const Hh=Phaser.Utils.Objects.GetValue;var $h=Phaser.Renderer.WebGL.Utils,Jh=function(t,e,i,s,r,n){for(var h=$h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ta=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ea=Phaser.Renderer.Canvas.SetTransform;var ia={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Jh(r,h,e,l,a,o),e.isStroked&&Kh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ea(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ra.prototype,ia);const na=Phaser.Utils.Objects.GetValue;let ha=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=na(t,"x",0),i=na(t,"y",0));var s=this.cornerRadius;s.tl=aa(na(t,"tl",void 0),e,i),s.tr=aa(na(t,"tr",void 0),e,i),s.bl=aa(na(t,"bl",void 0),e,i),s.br=aa(na(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oa(this.cornerRadius.br,t)}};var aa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),la(t),t},oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=na(e,"x",0),t.y=na(e,"y",0)),la(t)},la=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},da=function(t){return t.x>0&&t.y>0},ca=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ua=Phaser.Math.DegToRad;var pa=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const go=Phaser.Utils.Objects.GetValue,fo=Phaser.Utils.Objects.IsPlainObject;class mo extends(Wa(Ra)){constructor(t,e,i,s,r,n,h,a){fo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):fo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):fo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new po).setName("trackFill")).addShape((new po).setName("bar")).addShape((new po).setName("trackStroke")),this.setTrackColor(go(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(go(a,"trackStrokeThickness",2),go(a,"trackStrokeColor",void 0)),this.setSkewX(go(a,"skewX",0)),this.setRTL(go(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&vo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),vo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&vo(a,0,0,e,i,t)}};Object.assign(mo.prototype,yo);var bo=function(t){return null==t||""===t||0===t.length},Co=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(bo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(bo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;njo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=jo(t[i]));return e}const Io=Phaser.Utils.Objects.IsPlainObject,Wo=Phaser.Utils.Objects.GetValue;var Fo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Bo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},No={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ao),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=jo(i),s=jo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Io(t)?(this.stretchMode.edge=Fo(Wo(t,"edge",0)),this.stretchMode.internal=Fo(Wo(t,"internal",0))):(t=Fo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var $o=void 0,Jo=function(t,e){if($o||($o={},Ze(t).events.once("destroy",(function(){for(var t in $o)$o[t].destroy();$o=void 0}))),!$o.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),$o[e]=t}return $o[e]};const qo=Phaser.GameObjects.RenderTexture;class Ko extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Go(i)?(i=Uo(d=i,"x",0),s=Uo(d,"y",0),r=Uo(d,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(r)?(r=Uo(d=r,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(h)?(h=Uo(d=h,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(a)?(a=Uo(d=a,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Uo(d,"baseFrame",void 0)):Go(o)&&(o=Uo(d=o,"columns",void 0),l=Uo(d,"rows",void 0)),void 0===a&&(a=Uo(d,"frame",void 0)),void 0===o){var c=Uo(d,"leftWidth",void 0),u=Uo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Uo(d,"topHeight",void 0),v=Uo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Uo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Uo(d,"stretchMode",0)),this.setPreserveRatio(Uo(d,"preserveRatio",!0));var g=Uo(d,"maxFixedPartScale",1),f=Uo(d,"maxFixedPartScaleX",g),m=Uo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,No),i}(qo,"rexNinePatch")){}var Zo={_drawImage:function(t,e,i,s,r,n){var h=Jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ko.prototype,Zo);class Qo extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(wo(t,e))return t[e];var i=t.parent;return wo(i,e)?i[e]:void 0}set(t,e,i){return wo(t,e)?t[e]=i:wo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const tl=Phaser.Utils.Objects.GetValue;class el extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ko(this,i),this.style=new Qo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,xa);const il=["alpha","tint","flipX","flipY"];var sl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new So(t,e);break;case"image":s=new zo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ro(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=il.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class zl extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!hr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!hr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Al=Phaser.Utils.Objects.GetValue;class jl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Al(t,"value",0)),this.setSpeed(Al(t,"speed",0)),this.setAcceleration(Al(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Il{constructor(){this.value,this.dir,this.movement=new jl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Bl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Nl=Phaser.Utils.Objects.GetValue;class Gl extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Nl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Nl(e,"speed",.1)),this.setEnable(Nl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Nl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||hr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ul=Phaser.Utils.Objects.GetValue;var Hl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ul(s,l,void 0):Ul(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Ul(r,"position",0);"string"==typeof p&&(p=$l[p]);var v,g,f=Ul(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ul(s,"space.slider",void 0))&&(a?f=0:v=Ul(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ul(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ul(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ul(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ul(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ul(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ul(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Ul(s,C,!0):Ul(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new Gl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(P=h?"t":"s",x=`scroll${i}`):(P="t",x="scroll"),n.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),y&&(a?(w=`childO${i}`,x=`scroll${i}`):(w="childOY",x="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const $l={right:0,left:1,bottom:0,top:1},Jl={gameObject:0,rectBounds:1},ql=Phaser.Utils.Objects.GetValue;var Kl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ql(e,"width"),h=ql(e,"height");n||ql(e,"child.expandWidth",!0)||(s[1]=0),h||ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Uh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(t,a,"x",e)}return a},Zl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Od.prototype,Pd);const Ed=["top","bottom","centerY","center"],kd=["left","right","centerX","center"];var Td=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Ed.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=kd.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Md=Phaser.Utils.Objects.GetValue;class Dd extends rd{constructor(t,e){void 0===e&&(e={});var i=Oh(e),s=Md(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Md(e,"clampChildOY",!1),s.clampChildOX=Md(e,"clampChildOX",!1);var r,n,h=new Od(t,s);switch(t.add.existing(h),i){case 0:r=Md(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Md(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Md(e,"align.panel","center")};var a=Md(e,"space",void 0);a&&(a.child=Md(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Jn(this.childrenMap.child,t),this}}var Rd={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Td.call(this,t,"y",e);break;case 1:Td.call(this,t,"x",e);break;default:Td.call(this,t,"y",e),Td.call(this,t,"x",e)}return this}};return Object.assign(Dd.prototype,Rd),Dd},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexscrollablepanel=e(); diff --git a/dist/rexscrollbar.js b/dist/rexscrollbar.js index b194b33250..bad3aa24e1 100644 --- a/dist/rexscrollbar.js +++ b/dist/rexscrollbar.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$d(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$d(config, 'offsetX', 0); + offsetY = GetValue$d(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexscrollbar.min.js b/dist/rexscrollbar.min.js index 235494fa58..6bb91aa6af 100644 --- a/dist/rexscrollbar.min.js +++ b/dist/rexscrollbar.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Te=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ti(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Vi={};Object.assign(Vi,Wi),Vi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ki(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ki(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ki(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ki(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ti(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ts(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ws[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ws={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Es{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(xr(t,"enable",!0)),this.setCooldown(xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Tr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},kr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Be);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Tn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=kn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,ha,ua,ca,pa,va,fa);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ta=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Pa(r,a,e,l,h,o),e.isStroked&&xa(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ka(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ma.prototype,Da);const La=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){za(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ia=Phaser.Math.DegToRad;var Na=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Vh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Bh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ih(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Vh.prototype,Bh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return go.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Eo=Phaser.Utils.Objects.GetValue;class To extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eo(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(To.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new To(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Te=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ti(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Vi={};Object.assign(Vi,Wi),Vi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ki(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ki(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ki(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ki(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ti(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ts(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ws[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ws={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Es{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(xr(t,"enable",!0)),this.setCooldown(xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Tr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},kr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Be);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Tn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=kn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l,d,u){pe.call(this,t);var c=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=na[e];else if(ia(e)){var v;e=sa(v=e,"proportion",void 0),i=sa(v,"align",ra),s=sa(v,"padding",0),r=sa(v,"expand",!1),n=sa(v,"key",void 0),a=sa(v,"index",void 0),t.isRexSizer||(h=sa(v,"minWidth",void 0),o=sa(v,"minHeight",void 0)),l=sa(v,"fitRatio",0),d=sa(v,"offsetX",0),u=sa(v,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(c?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=u,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,ha,ua,ca,pa,va,fa);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ta=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Pa(r,a,e,l,h,o),e.isStroked&&xa(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ka(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ma.prototype,Da);const La=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){za(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ia=Phaser.Math.DegToRad;var Na=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Vh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Bh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ih(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Vh.prototype,Bh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return go.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Eo=Phaser.Utils.Objects.GetValue;class To extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eo(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(To.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new To(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexsimpledropdownlist.min.js b/dist/rexsimpledropdownlist.min.js index 6005f4f959..d96a1676e2 100644 --- a/dist/rexsimpledropdownlist.min.js +++ b/dist/rexsimpledropdownlist.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Re={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Mi(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Di),Yi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Gi),Ni.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ys,As,zs,Xs);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;class Gs extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Vs extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Gs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Ks={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=Ks.popUp;break;case ir.fadeIn:t=Ks.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Ks.scaleDown;break;case ir.fadeOut:t=Ks.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new xr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Or(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Ls{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ar=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=Cn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=Cn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",Sn="BEGIN",wn="RECOGNIZED",On=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(On(e,"inputConfig",void 0)),this.setEventEmitter(On(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(On(t,"enable",!0)),this.bounds=On(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case Rn:this.tracerState=Mn,this.onDrag1End();break;case Ln:this.tracerState=Rn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var En={};const Mn=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var An=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},zn={};const Xn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Gn="BEGIN",Nn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Gr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),qn.call(t,e),t},th={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Xe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,vh,yh,bh,xh,Ch,Sh);var Oh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=kh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Oh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Rh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Lh={appendText:Rh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Dh extends Eh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Mh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Mh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Dh.prototype,Lh);var Yh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const zh=Phaser.GameObjects.Graphics;class Xh extends zh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Wh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Yh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Yh.call(this,this.width,this.height,this.padding,t,e)),this}}const Wh={rectangle:0,circle:1};var Bh=function(t,e,i,s){var r=new Xh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const jh=Phaser.GameObjects.Text;var Ih=function(t){return t instanceof jh};const Fh=Phaser.GameObjects.BitmapText;var Hh=function(t){return t instanceof Fh},Gh=function(t){return Hh(t)?2:Ih(t)?0:1},Nh=/^[\x00-\x7F]+$/,Vh=function(t){return Nh.test(t)},Uh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Jh=0,Kh=1,qh=2,Zh=0,Qh=1,ta=2,ea=/(?:\r\n|\r|\n)/;const ia={none:Zh,word:Qh,char:ta,character:ta,mix:3},sa=Phaser.Renderer.WebGL.Utils;var ra={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const na=Phaser.Display.Color;var ha={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new na);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},aa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},oa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,aa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const la=Phaser.Display.Canvas.CanvasPool,da=Phaser.GameObjects.GameObject,ca=Phaser.Utils.String.UUID;class ua extends da{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=la.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ca(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){la.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const pa=Phaser.GameObjects.Components;Phaser.Class.mixin(ua,[pa.Alpha,pa.BlendMode,pa.Crop,pa.Depth,pa.Flip,pa.GetBounds,pa.Mask,pa.Origin,pa.Pipeline,pa.PostPipeline,pa.ScrollFactor,pa.Tint,pa.Transform,pa.Visible,ra,ha,oa]);var va={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ga{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ga.prototype,va);var fa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ma=Phaser.Math.RotateAround;var ya;const ba=Phaser.Geom.Rectangle;var xa,Ca=function(t){void 0===xa&&(xa=new ba);var e=t.drawTLX,i=t.drawTLY;return xa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),xa};const Sa=Phaser.Math.RotateAround;var wa,Oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===wa&&(wa={}),s=wa),s.x=e,s.y=i,0!==t.rotation&&Sa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ka=Phaser.GameObjects.Components.TransformMatrix;var Pa,_a,Ta={},Ea=function(t,e,i,s,r){var n=Oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ta);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new ka,_a=new ka),t.parentContainer?t.getWorldTransformMatrix(Pa,_a):Pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ma=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ea(t,e,n,h,r)},Ra={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ya&&(ya={}),s=ya),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ma(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ma(this.parent,this,t,e,i)}};Object.assign(Ra,fa);const La=Phaser.Math.DegToRad,Da=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Aa extends ga{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Da(this._rotation)}set angle(t){this.rotation=La(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Aa.prototype,Ra);const za=Phaser.Utils.String.Pad;var Xa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${za(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ba=Phaser.Utils.Objects.GetValue;let ja=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ba(t,"x",0),i=Ba(t,"y",0));var s=this.cornerRadius;s.tl=Ia(Ba(t,"tl",void 0),e,i),s.tr=Ia(Ba(t,"tr",void 0),e,i),s.bl=Ia(Ba(t,"bl",void 0),e,i),s.br=Ia(Ba(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Ia=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ha(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ba(e,"x",0),t.y=Ba(e,"y",0)),Ha(t)},Ha=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Na=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Ua=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,o,l,o,l,180,270,!1,h):Ua(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,s-o,l,o,l,270,360,!1,h):Ua(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,s-o,r-l,o,l,0,90,!1,h):Ua(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,o,r-l,o,l,90,180,!1,h):Ua(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ja=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),$a(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ka=Phaser.Utils.Objects.GetValue;class qa extends Aa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ka(e,"color",null),Ka(e,"color2",null),Ka(e,"horizontalGradient",!0)),this.setStroke(Ka(e,"stroke",null),Ka(e,"strokeThickness",2)),this.setCornerRadius(Ka(e,"cornerRadius",0),Ka(e,"cornerIteration",null))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Wa("color2",t,this),Wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Wa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ja(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Za=Phaser.Utils.Objects.GetValue;class Qa extends Aa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Za(e,"color",null),Za(e,"color2",null),Za(e,"horizontalGradient",!0)),this.setStroke(Za(e,"stroke",null),Za(e,"strokeThickness",2))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Za(t,"color2",null),Za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const to=Phaser.Utils.Objects.GetValue;let eo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(to(t,"bold",!1)),this.setItalic(to(t,"italic",!1)),this.setFontSize(to(t,"fontSize","16px")),this.setFontFamily(to(t,"fontFamily","Courier")),this.setColor(to(t,"color","#fff")),this.setStrokeStyle(to(t,"stroke",null),to(t,"strokeThickness",0)),this.setShadow(to(t,"shadowColor",null),to(t,"shadowOffsetX",0),to(t,"shadowOffsetY",0),to(t,"shadowBlur",0)),this.setOffset(to(t,"offsetX",0),to(t,"offsetY",0)),this.setSpace(to(t,"leftSpace",0),to(t,"rightSpace",0)),this.setAlign(to(t,"align",void 0)),this.setBackgroundColor(to(t,"backgroundColor",null)),this.setBackgroundHeight(to(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(to(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Wa("stroke",t,this),Wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Wa("shadowOffsetX",t,this),Wa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Xa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Xa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Xa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Xa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const io=Phaser.Utils.Array.Remove,so=Phaser.Utils.Array.Remove,ro="text",no="image",ho="drawer",ao="space",oo="command";var lo=function(t){return t.type===ro&&"\n"===t.text},co=function(t){return t.type===ro&&"\f"===t.text},uo=function(t){return t.type===ro};class po extends Aa{constructor(t,e,i){super(t,ro),this.updateTextFlag=!1,this.style=new eo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var vo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const go=Phaser.Display.Canvas.CanvasPool;var fo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=go.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),go.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class mo extends Aa{constructor(t,e,i){super(t,no),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){fo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class yo extends Aa{constructor(t,e,i,s){super(t,ho),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class bo extends Aa{constructor(t,e){super(t,ao),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class xo extends ga{constructor(t,e,i,s,r){super(t,oo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Co(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Co(t[i]));return e}var So=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wo={none:0,word:1,char:2,character:2,mix:3};var Oo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=To.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=To.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Mo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Mo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Mo(t,"wrapMode");void 0===c&&(c=Mo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wo[c]);var u=Mo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Mo(t,"letterSpacing",0),v=Mo(t,"hAlign",0),g=Mo(t,"vAlign",0),f=Mo(t,"justifyPercentage",.25),m=So({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Do(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Do(t,"maxLines",0);var a=0===i,o=Do(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Do(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Do(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Do(t,"letterSpacing",0),p=Do(t,"rtl",!0),v=Do(t,"hAlign",p?2:0),g=Do(t,"vAlign",0),f=So({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),io(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ro);return null===i?i=new po(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ma(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const rl=Phaser.Utils.Objects.GetFastValue;var nl={};class hl{constructor(t){this.pools=rl(t,"pools",nl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new sl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=vl(t,r,e,i,n),a=0;a<=cl&&0!==h;a++){if((r+=h)<0){r=0;break}h=vl(t,r,e,i,n)}return a===cl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),gl(t,e,i),t},pl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},vl=function(t,e,i,s,r){var n,h=pl(t,e,r),a=pl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},gl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const fl=Phaser.Utils.Objects.GetValue,ml=Phaser.Utils.Objects.GetValue;class yl extends Dh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ml(e,"background",void 0),r=ml(e,"icon",void 0),n=ml(e,"iconMask",void 0),h=ml(e,"text",void 0),a=ml(e,"action",void 0),o=ml(e,"actionMask",void 0),l=ml(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ml(e,"space.icon",0),top:ml(e,"space.iconTop",0),bottom:ml(e,"space.iconBottom",0),left:ml(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ml(e,"space.icon",0),left:ml(e,"space.iconLeft",0),right:ml(e,"space.iconRight",0),top:ml(e,"space.iconTop",0)});var d=ml(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Bh.call(this,r,r,1)),!d){var c=ml(e,"iconSize",void 0);this.setIconSize(ml(e,"iconWidth",c),ml(e,"iconHeight",c))}}if(h){var u=ml(e,"wrapText",!1),p=ml(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,dl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=fl(e,"minWidth",0),s=fl(e,"minHeight",0),r=fl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ul(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ul(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ml(e,"space.text",0),m=ml(e,"expandTextWidth",!1),y=ml(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ml(e,"space.actionTop",0),bottom:ml(e,"space.actionBottom",0),right:ml(e,"space.actionRight",0)}:{left:ml(e,"space.actionLeft",0),right:ml(e,"space.actionRight",0),bottom:ml(e,"space.actionBottom",0)},d=ml(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Bh.call(this,a,a,1)),!d)){var b=ml(e,"actionSize");this.setActionSize(ml(e,"actionWidth",b),ml(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var bl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=xl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const xl={down:0,up:1},Cl=Eh.prototype.add,Sl=Eh.prototype.addSpace;var wl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Sl.call(this),Cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Sl.call(this),this.hasTailSpace=s}else Cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Cl.call(this,t,{index:r,proportion:i,expand:!0})}else Cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ol={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)_l.call(this,e[i],t);return this}},El=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Ml=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,El.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Rl={add(t){return this.buttons.push(t),t._click||(t._click=new xr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Ml.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Nl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Nl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Ul=Phaser.Utils.Objects.IsPlainObject,$l=Phaser.Utils.Objects.GetValue,Jl=Phaser.Display.Align.CENTER;var Kl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Ul(e)&&(e=$l(r=e,"padding",0),i=$l(r,"key",void 0),s=$l(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Jl,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},ql={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},td={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&ad.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ud.call(this,e[i],t);return this}};const vd=Phaser.Utils.Objects.GetValue;class gd extends nd{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Wl({parent:this,eventEmitter:vd(e,"eventEmitter",this),groupName:vd(e,"groupName",void 0),clickConfig:vd(e,"click",void 0)}).setButtonsType(e);var s=vd(e,"background",void 0),r=vd(e,"buttons",void 0);this.buttonsAlign=vd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(gd.prototype,ld,pd,Xl,jl);var fd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},md=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=yd(t));var i=t[e];return"string"==typeof i&&(i=fd[i]),i},yd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},bd=function(){return Array.prototype.reduce.call(arguments,xd,0)},xd=function(t,e){return t+e};const Cd=Phaser.Utils.Objects.IsPlainObject,Sd=Phaser.Utils.Objects.GetValue,wd=Phaser.Display.Align.CENTER;var Od=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pd(this.sizerChildren,null),fh.call(this,t),this}},Td={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ld={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Pd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Yd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ad=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Xd extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Ad(e)?(e=zd(l=e,"x",0),i=zd(l,"y",0),s=zd(l,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(s)?(s=zd(l=s,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(n)?(n=zd(l=n,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(a)&&(a=zd(l=a,"columnProportions",0),o=zd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(zd(l,"createCellContainerCallback")),this.setIndentLeft(zd(l,"space.indentLeftOdd",0),zd(l,"space.indentLeftEven",0)),this.setIndentTop(zd(l,"space.indentTopOdd",0),zd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,zd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Dd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Yd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Xd.prototype,Ld);const Wd=Phaser.Utils.Objects.GetValue;var Bd=Phaser.Renderer.WebGL.Utils,jd=function(t,e,i,s,r,n){for(var h=Bd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Nd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Vd=Phaser.Renderer.Canvas.SetTransform;var Ud={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&jd(r,h,e,l,a,o),e.isStroked&&Fd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Vd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Jd.prototype,Ud);var Kd=function(t){return t.x>0&&t.y>0},qd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Zd=Phaser.Math.DegToRad;var Qd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Utils.Objects.IsPlainObject;class tu extends(kc(mc)){constructor(t,e,i,s,r,n,h,a){Qc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Qc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Qc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Zc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Zc(a,"trackStrokeThickness",2),Zc(a,"trackStrokeColor",void 0)),this.setSkewX(Zc(a,"skewX",0)),this.setRTL(Zc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var eu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&qc(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),qc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&qc(a,0,0,e,i,t)}};Object.assign(tu.prototype,eu);var iu=function(t){return null==t||""===t||0===t.length},su=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(iu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(iu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Co(i),s=Co(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Cu(t)?(this.stretchMode.edge=wu(Su(t,"edge",0)),this.stretchMode.internal=wu(Su(t,"internal",0))):(t=wu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ku.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const _u=Phaser.Utils.Objects.IsPlainObject,Tu=Phaser.Utils.Objects.GetValue,Eu=Phaser.GameObjects;var Mu=void 0,Ru=function(t,e){if(Mu||(Mu={},Ze(t).events.once("destroy",(function(){for(var t in Mu)Mu[t].destroy();Mu=void 0}))),!Mu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Eu[e](i)).setOrigin(0),Mu[e]=t}return Mu[e]};const Lu=Phaser.GameObjects.RenderTexture;class Du extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(_u(i)?(i=Tu(d=i,"x",0),s=Tu(d,"y",0),r=Tu(d,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(r)?(r=Tu(d=r,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(h)?(h=Tu(d=h,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(a)?(a=Tu(d=a,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Tu(d,"baseFrame",void 0)):_u(o)&&(o=Tu(d=o,"columns",void 0),l=Tu(d,"rows",void 0)),void 0===a&&(a=Tu(d,"frame",void 0)),void 0===o){var c=Tu(d,"leftWidth",void 0),u=Tu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Tu(d,"topHeight",void 0),v=Tu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Tu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Tu(d,"stretchMode",0)),this.setPreserveRatio(Tu(d,"preserveRatio",!0));var g=Tu(d,"maxFixedPartScale",1),f=Tu(d,"maxFixedPartScaleX",g),m=Tu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Pu),i}(Lu,"rexNinePatch")){}var Yu={_drawImage:function(t,e,i,s,r,n){var h=Ru(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ru(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Du.prototype,Yu);let Au=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(hu(t,e))return t[e];var i=t.parent;return hu(i,e)?i[e]:void 0}set(t,e,i){return hu(t,e)?t[e]=i:hu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const zu=Phaser.Utils.Objects.GetValue;class Xu extends Du{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zu(e,"effects",!0);i&&cu(this,i),this.style=new Au(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xu.prototype,lc);const Wu=["alpha","tint","flipX","flipY"];var Bu=function(t,e){if(!e)return t;for(var i=0,s=Wu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const mp=Phaser.Utils.Objects.GetValue,yp=Phaser.Math.Distance.Between;class bp extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(mp(t,"enable",!0)),this.holdThreshold=mp(t,"holdThreshold",50),this.pointerOutReleaseEnable=mp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const xp=Phaser.Utils.Objects.GetValue;class Cp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xp(t,"value",0)),this.setSpeed(xp(t,"speed",0)),this.setAcceleration(xp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Sp{constructor(){this.value,this.dir,this.movement=new Cp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Pp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},_p=Phaser.Utils.Objects.GetValue;class Tp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=_p(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(_p(e,"speed",.1)),this.setEnable(_p(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(_p(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ep=Phaser.Utils.Objects.GetValue;var Mp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ep(s,l,void 0):Ep(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new gp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Ep(r,"position",0);"string"==typeof p&&(p=Rp[p]);var v,g,f=Ep(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ep(s,"space.slider",void 0))&&(a?f=0:v=Ep(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ep(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ep(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ep(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ep(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ep(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ep(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ep(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ep(s,"scrollDetectionMode");"string"==typeof b&&(b=Lp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Ep(s,x,!0):Ep(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new kp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Ep(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Tp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Rp={right:0,left:1,bottom:0,top:1},Lp={gameObject:0,rectBounds:1},Dp=Phaser.Utils.Objects.GetValue;var Yp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Dp(e,"width"),h=Dp(e,"height");n||Dp(e,"child.expandWidth",!0)||(s[1]=0),h||Dp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Xd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Wd(i,"child"),r=Wd(s,"gameObject",void 0);if(r){var n=Wd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),a.left=Wd(n,"left",0),a.right=Wd(n,"right",0);break;case 1:h.top=Wd(n,"left",0),h.bottom=Wd(n,"right",0),a.top=Wd(n,"top",0),a.bottom=Wd(n,"bottom",0);break;default:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),h.left=Wd(n,"left",0),h.right=Wd(n,"right",0)}e.add(r,{column:1,row:1,align:Wd(s,"align","center"),padding:a,expand:{width:Wd(s,"expandWidth",!0),height:Wd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Mp(t,a,"y",e);break;case 1:Mp(t,a,"x",e);break;default:Mp(t,a,"y",e),Mp(t,a,"x",e)}return a},Ap=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},zp=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Xp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(rv.prototype,tv);const nv=["top","bottom","centerY","center"],hv=["left","right","centerX","center"];var av=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=nv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=hv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ov=Phaser.Utils.Objects.GetValue;class lv extends Ip{constructor(t,e){void 0===e&&(e={});var i=md(e),s=ov(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ov(e,"clampChildOY",!1),s.clampChildOX=ov(e,"clampChildOX",!1);var r,n,h=new rv(t,s);switch(t.add.existing(h),i){case 0:r=ov(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ov(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:ov(e,"align.panel","center")};var a=ov(e,"space",void 0);a&&(a.child=ov(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Qn(this.childrenMap.child,t),this}}var dv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:av.call(this,t,"y",e);break;case 1:av.call(this,t,"x",e);break;default:av.call(this,t,"y",e),av.call(this,t,"x",e)}return this}};Object.assign(lv.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;var uv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=pv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=vv(e,this.listCreateSliderTrackCallback),v=vv(e,this.listCreateSliderThumbCallback);d=new lv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:cv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=pv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},pv=function(t,e,i){var s;return i?(e.orientation="x",s=new gd(t,e)):(e.orientation="y",s=new Fl(t,e)),t.add.existing(s),s},vv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},gv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const yv={down:0,up:1},bv=Phaser.Utils.Objects.GetValue;class xv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mv(t,e),t.isRexSizer&&t.layout();var i=bv(e,"touchOutsideClose",!1),s=bv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Cv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Sv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=uv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new xv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Sv,bl,Cv);const wv=Phaser.Utils.Objects.GetValue;class Ov extends yl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(wv(e,"options"));var i=wv(e,"list");this.setWrapEnable(wv(i,"wrap",!1)),this.setCreateButtonCallback(wv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(wv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(wv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(wv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(wv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(wv(i,"scroller")),this.setListMouseWheelScrollerConfig(wv(i,"mouseWheelScroller")),this.setButtonClickCallback(wv(i,"onButtonClick")),this.setButtonOverCallback(wv(i,"onButtonOver")),this.setButtonOutCallback(wv(i,"onButtonOut")),this.setListExpandDirection(wv(i,"expandDirection")),this.setListEaseInDuration(wv(i,"easeIn",500)),this.setListEaseOutDuration(wv(i,"easeOut",100)),this.setListTransitInCallback(wv(i,"transitIn")),this.settListTransitOutCallback(wv(i,"transitOut")),this.setListMaxHeight(wv(i,"maxHeight",0)),this.setListSize(wv(i,"width"),wv(i,"height",0)),this.setListAlignmentMode(wv(i,"alignParent","text")),this.setListAlignmentSide(wv(i,"alignSide","")),this.setListBounds(wv(i,"bounds")),this.setListSpace(wv(i,"space")),this.setListDraggable(wv(i,"draggable",!1)),this.setValueChangeCallback(wv(e,"setValueCallback"),wv(e,"setValueCallbackScope")),this.setValue(wv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(Ov.prototype,Sv);const kv=Phaser.GameObjects.Text,Pv=Phaser.Utils.Objects.GetValue;class _v extends kv{constructor(t,e){void 0===e&&(e={}),super(t,Pv(e,"x",0),Pv(e,"y",0),Pv(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(_v.prototype,lc);var Tv=Phaser.Renderer.WebGL.Utils,Ev={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Tv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Mv=Phaser.Display.Canvas.CanvasPool;e();const Rv=Phaser.GameObjects.GameObject;class Lv extends Rv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Mv.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Mv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Re={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Be=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Mi(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Di),Yi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Gi),Ni.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Je(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ys,As,zs,Xs);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Bs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;class Gs extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Vs extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Gs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Ks={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=Ks.popUp;break;case ir.fadeIn:t=Ks.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Ks.scaleDown;break;case ir.fadeOut:t=Ks.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new xr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Or(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Ls{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ar=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Kr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=Cn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=Cn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",Sn="BEGIN",wn="RECOGNIZED",On=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(On(e,"inputConfig",void 0)),this.setEventEmitter(On(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(On(t,"enable",!0)),this.bounds=On(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case Rn:this.tracerState=Mn,this.onDrag1End();break;case Ln:this.tracerState=Rn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var En={};const Mn=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var An=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},zn={};const Xn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Gn="BEGIN",Nn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Gr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),qn.call(t,e),t},th={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l,d,c){ge.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=uh[e];else if(lh(e)){var v;e=dh(v=e,"proportion",void 0),i=dh(v,"align",ch),s=dh(v,"padding",0),r=dh(v,"expand",!1),n=dh(v,"key",void 0),h=dh(v,"index",void 0),t.isRexSizer||(a=dh(v,"minWidth",void 0),o=dh(v,"minHeight",void 0)),l=dh(v,"fitRatio",0),d=dh(v,"offsetX",0),c=dh(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=pe(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Xe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,vh,yh,bh,xh,Ch,Sh);var Oh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=kh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Oh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Rh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Lh={appendText:Rh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Dh extends Eh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Mh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Mh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Dh.prototype,Lh);var Yh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const zh=Phaser.GameObjects.Graphics;class Xh extends zh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Wh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Yh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Yh.call(this,this.width,this.height,this.padding,t,e)),this}}const Wh={rectangle:0,circle:1};var Bh=function(t,e,i,s){var r=new Xh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const jh=Phaser.GameObjects.Text;var Ih=function(t){return t instanceof jh};const Fh=Phaser.GameObjects.BitmapText;var Hh=function(t){return t instanceof Fh},Gh=function(t){return Hh(t)?2:Ih(t)?0:1},Nh=/^[\x00-\x7F]+$/,Vh=function(t){return Nh.test(t)},Uh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Jh=0,Kh=1,qh=2,Zh=0,Qh=1,ta=2,ea=/(?:\r\n|\r|\n)/;const ia={none:Zh,word:Qh,char:ta,character:ta,mix:3},sa=Phaser.Renderer.WebGL.Utils;var ra={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const na=Phaser.Display.Color;var ha={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new na);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},aa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},oa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,aa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const la=Phaser.Display.Canvas.CanvasPool,da=Phaser.GameObjects.GameObject,ca=Phaser.Utils.String.UUID;class ua extends da{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=la.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ca(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){la.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const pa=Phaser.GameObjects.Components;Phaser.Class.mixin(ua,[pa.Alpha,pa.BlendMode,pa.Crop,pa.Depth,pa.Flip,pa.GetBounds,pa.Mask,pa.Origin,pa.Pipeline,pa.PostPipeline,pa.ScrollFactor,pa.Tint,pa.Transform,pa.Visible,ra,ha,oa]);var va={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class ga{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ga.prototype,va);var fa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ma=Phaser.Math.RotateAround;var ya;const ba=Phaser.Geom.Rectangle;var xa,Ca=function(t){void 0===xa&&(xa=new ba);var e=t.drawTLX,i=t.drawTLY;return xa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),xa};const Sa=Phaser.Math.RotateAround;var wa,Oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===wa&&(wa={}),s=wa),s.x=e,s.y=i,0!==t.rotation&&Sa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ka=Phaser.GameObjects.Components.TransformMatrix;var Pa,_a,Ta={},Ea=function(t,e,i,s,r){var n=Oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ta);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new ka,_a=new ka),t.parentContainer?t.getWorldTransformMatrix(Pa,_a):Pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ma=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ea(t,e,n,h,r)},Ra={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ya&&(ya={}),s=ya),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ma(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ma(this.parent,this,t,e,i)}};Object.assign(Ra,fa);const La=Phaser.Math.DegToRad,Da=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Aa extends ga{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Da(this._rotation)}set angle(t){this.rotation=La(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Aa.prototype,Ra);const za=Phaser.Utils.String.Pad;var Xa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${za(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ba=Phaser.Utils.Objects.GetValue;let ja=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ba(t,"x",0),i=Ba(t,"y",0));var s=this.cornerRadius;s.tl=Ia(Ba(t,"tl",void 0),e,i),s.tr=Ia(Ba(t,"tr",void 0),e,i),s.bl=Ia(Ba(t,"bl",void 0),e,i),s.br=Ia(Ba(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Ia=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ha(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ba(e,"x",0),t.y=Ba(e,"y",0)),Ha(t)},Ha=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Na=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Ua=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,o,l,o,l,180,270,!1,h):Ua(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,s-o,l,o,l,270,360,!1,h):Ua(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,s-o,r-l,o,l,0,90,!1,h):Ua(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Va(a)?(o=a.x*g,l=a.y*f,Na(a)?Ua(t,o,r-l,o,l,90,180,!1,h):Ua(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ja=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),$a(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ka=Phaser.Utils.Objects.GetValue;class qa extends Aa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ka(e,"color",null),Ka(e,"color2",null),Ka(e,"horizontalGradient",!0)),this.setStroke(Ka(e,"stroke",null),Ka(e,"strokeThickness",2)),this.setCornerRadius(Ka(e,"cornerRadius",0),Ka(e,"cornerIteration",null))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Wa("color2",t,this),Wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Wa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ja(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Za=Phaser.Utils.Objects.GetValue;class Qa extends Aa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Za(e,"color",null),Za(e,"color2",null),Za(e,"horizontalGradient",!0)),this.setStroke(Za(e,"stroke",null),Za(e,"strokeThickness",2))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Za(t,"color2",null),Za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const to=Phaser.Utils.Objects.GetValue;let eo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(to(t,"bold",!1)),this.setItalic(to(t,"italic",!1)),this.setFontSize(to(t,"fontSize","16px")),this.setFontFamily(to(t,"fontFamily","Courier")),this.setColor(to(t,"color","#fff")),this.setStrokeStyle(to(t,"stroke",null),to(t,"strokeThickness",0)),this.setShadow(to(t,"shadowColor",null),to(t,"shadowOffsetX",0),to(t,"shadowOffsetY",0),to(t,"shadowBlur",0)),this.setOffset(to(t,"offsetX",0),to(t,"offsetY",0)),this.setSpace(to(t,"leftSpace",0),to(t,"rightSpace",0)),this.setAlign(to(t,"align",void 0)),this.setBackgroundColor(to(t,"backgroundColor",null)),this.setBackgroundHeight(to(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(to(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Wa("stroke",t,this),Wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Wa("shadowOffsetX",t,this),Wa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Xa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Xa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Xa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Xa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const io=Phaser.Utils.Array.Remove,so=Phaser.Utils.Array.Remove,ro="text",no="image",ho="drawer",ao="space",oo="command";var lo=function(t){return t.type===ro&&"\n"===t.text},co=function(t){return t.type===ro&&"\f"===t.text},uo=function(t){return t.type===ro};class po extends Aa{constructor(t,e,i){super(t,ro),this.updateTextFlag=!1,this.style=new eo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var vo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const go=Phaser.Display.Canvas.CanvasPool;var fo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=go.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),go.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class mo extends Aa{constructor(t,e,i){super(t,no),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){fo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class yo extends Aa{constructor(t,e,i,s){super(t,ho),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class bo extends Aa{constructor(t,e){super(t,ao),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class xo extends ga{constructor(t,e,i,s,r){super(t,oo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Co(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Co(t[i]));return e}var So=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wo={none:0,word:1,char:2,character:2,mix:3};var Oo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=To.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=To.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Mo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Mo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Mo(t,"wrapMode");void 0===c&&(c=Mo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wo[c]);var u=Mo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Mo(t,"letterSpacing",0),v=Mo(t,"hAlign",0),g=Mo(t,"vAlign",0),f=Mo(t,"justifyPercentage",.25),m=So({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Do(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Do(t,"maxLines",0);var a=0===i,o=Do(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Do(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Do(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Do(t,"letterSpacing",0),p=Do(t,"rtl",!0),v=Do(t,"hAlign",p?2:0),g=Do(t,"vAlign",0),f=So({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),io(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ro);return null===i?i=new po(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ma(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const rl=Phaser.Utils.Objects.GetFastValue;var nl={};class hl{constructor(t){this.pools=rl(t,"pools",nl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new sl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=vl(t,r,e,i,n),a=0;a<=cl&&0!==h;a++){if((r+=h)<0){r=0;break}h=vl(t,r,e,i,n)}return a===cl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),gl(t,e,i),t},pl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},vl=function(t,e,i,s,r){var n,h=pl(t,e,r),a=pl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},gl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const fl=Phaser.Utils.Objects.GetValue,ml=Phaser.Utils.Objects.GetValue;class yl extends Dh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ml(e,"background",void 0),r=ml(e,"icon",void 0),n=ml(e,"iconMask",void 0),h=ml(e,"text",void 0),a=ml(e,"action",void 0),o=ml(e,"actionMask",void 0),l=ml(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ml(e,"space.icon",0),top:ml(e,"space.iconTop",0),bottom:ml(e,"space.iconBottom",0),left:ml(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ml(e,"space.icon",0),left:ml(e,"space.iconLeft",0),right:ml(e,"space.iconRight",0),top:ml(e,"space.iconTop",0)});var d=ml(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Bh.call(this,r,r,1)),!d){var c=ml(e,"iconSize",void 0);this.setIconSize(ml(e,"iconWidth",c),ml(e,"iconHeight",c))}}if(h){var u=ml(e,"wrapText",!1),p=ml(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,dl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=fl(e,"minWidth",0),s=fl(e,"minHeight",0),r=fl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ul(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ul(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=ml(e,"space.text",0),m=ml(e,"expandTextWidth",!1),y=ml(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:ml(e,"space.actionTop",0),bottom:ml(e,"space.actionBottom",0),right:ml(e,"space.actionRight",0)}:{left:ml(e,"space.actionLeft",0),right:ml(e,"space.actionRight",0),bottom:ml(e,"space.actionBottom",0)},d=ml(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Bh.call(this,a,a,1)),!d)){var b=ml(e,"actionSize");this.setActionSize(ml(e,"actionWidth",b),ml(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var bl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=xl[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const xl={down:0,up:1},Cl=Eh.prototype.add,Sl=Eh.prototype.addSpace;var wl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Sl.call(this),Cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Sl.call(this),this.hasTailSpace=s}else Cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Cl.call(this,t,{index:r,proportion:i,expand:!0})}else Cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ol={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)_l.call(this,e[i],t);return this}},El=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},Ml=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,El.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Rl={add(t){return this.buttons.push(t),t._click||(t._click=new xr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),Ml.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Nl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Nl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Ul=Phaser.Utils.Objects.IsPlainObject,$l=Phaser.Utils.Objects.GetValue,Jl=Phaser.Display.Align.CENTER;var Kl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Ul(e)&&(e=$l(r=e,"padding",0),i=$l(r,"key",void 0),s=$l(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Jl,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},ql={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fh.call(this,t),this}},td={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&ad.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ud.call(this,e[i],t);return this}};const vd=Phaser.Utils.Objects.GetValue;class gd extends nd{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Wl({parent:this,eventEmitter:vd(e,"eventEmitter",this),groupName:vd(e,"groupName",void 0),clickConfig:vd(e,"click",void 0)}).setButtonsType(e);var s=vd(e,"background",void 0),r=vd(e,"buttons",void 0);this.buttonsAlign=vd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(gd.prototype,ld,pd,Xl,jl);var fd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},md=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=yd(t));var i=t[e];return"string"==typeof i&&(i=fd[i]),i},yd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},bd=function(){return Array.prototype.reduce.call(arguments,xd,0)},xd=function(t,e){return t+e};const Cd=Phaser.Utils.Objects.IsPlainObject,Sd=Phaser.Utils.Objects.GetValue,wd=Phaser.Display.Align.CENTER;var Od=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Pd(this.sizerChildren,null),fh.call(this,t),this}},Td={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ld={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Pd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Yd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ad=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Xd extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Ad(e)?(e=zd(l=e,"x",0),i=zd(l,"y",0),s=zd(l,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(s)?(s=zd(l=s,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(n)?(n=zd(l=n,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(a)&&(a=zd(l=a,"columnProportions",0),o=zd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(zd(l,"createCellContainerCallback")),this.setIndentLeft(zd(l,"space.indentLeftOdd",0),zd(l,"space.indentLeftEven",0)),this.setIndentTop(zd(l,"space.indentTopOdd",0),zd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,zd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Dd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Yd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Xd.prototype,Ld);const Wd=Phaser.Utils.Objects.GetValue;var Bd=Phaser.Renderer.WebGL.Utils,jd=function(t,e,i,s,r,n){for(var h=Bd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Nd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Vd=Phaser.Renderer.Canvas.SetTransform;var Ud={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&jd(r,h,e,l,a,o),e.isStroked&&Fd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Vd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Jd.prototype,Ud);var Kd=function(t){return t.x>0&&t.y>0},qd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Zd=Phaser.Math.DegToRad;var Qd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Utils.Objects.IsPlainObject;class tu extends(kc(mc)){constructor(t,e,i,s,r,n,h,a){Qc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Qc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Qc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Zc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Zc(a,"trackStrokeThickness",2),Zc(a,"trackStrokeColor",void 0)),this.setSkewX(Zc(a,"skewX",0)),this.setRTL(Zc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var eu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&qc(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),qc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&qc(a,0,0,e,i,t)}};Object.assign(tu.prototype,eu);var iu=function(t){return null==t||""===t||0===t.length},su=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(iu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(iu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Co(i),s=Co(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Cu(t)?(this.stretchMode.edge=wu(Su(t,"edge",0)),this.stretchMode.internal=wu(Su(t,"internal",0))):(t=wu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ku.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const _u=Phaser.Utils.Objects.IsPlainObject,Tu=Phaser.Utils.Objects.GetValue,Eu=Phaser.GameObjects;var Mu=void 0,Ru=function(t,e){if(Mu||(Mu={},Ze(t).events.once("destroy",(function(){for(var t in Mu)Mu[t].destroy();Mu=void 0}))),!Mu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Eu[e](i)).setOrigin(0),Mu[e]=t}return Mu[e]};const Lu=Phaser.GameObjects.RenderTexture;class Du extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(_u(i)?(i=Tu(d=i,"x",0),s=Tu(d,"y",0),r=Tu(d,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(r)?(r=Tu(d=r,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(h)?(h=Tu(d=h,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(a)?(a=Tu(d=a,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Tu(d,"baseFrame",void 0)):_u(o)&&(o=Tu(d=o,"columns",void 0),l=Tu(d,"rows",void 0)),void 0===a&&(a=Tu(d,"frame",void 0)),void 0===o){var c=Tu(d,"leftWidth",void 0),u=Tu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Tu(d,"topHeight",void 0),v=Tu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Tu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Tu(d,"stretchMode",0)),this.setPreserveRatio(Tu(d,"preserveRatio",!0));var g=Tu(d,"maxFixedPartScale",1),f=Tu(d,"maxFixedPartScaleX",g),m=Tu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Pu),i}(Lu,"rexNinePatch")){}var Yu={_drawImage:function(t,e,i,s,r,n){var h=Ru(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ru(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Du.prototype,Yu);let Au=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(hu(t,e))return t[e];var i=t.parent;return hu(i,e)?i[e]:void 0}set(t,e,i){return hu(t,e)?t[e]=i:hu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const zu=Phaser.Utils.Objects.GetValue;class Xu extends Du{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zu(e,"effects",!0);i&&cu(this,i),this.style=new Au(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xu.prototype,lc);const Wu=["alpha","tint","flipX","flipY"];var Bu=function(t,e){if(!e)return t;for(var i=0,s=Wu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const mp=Phaser.Utils.Objects.GetValue,yp=Phaser.Math.Distance.Between;class bp extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(mp(t,"enable",!0)),this.holdThreshold=mp(t,"holdThreshold",50),this.pointerOutReleaseEnable=mp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const xp=Phaser.Utils.Objects.GetValue;class Cp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xp(t,"value",0)),this.setSpeed(xp(t,"speed",0)),this.setAcceleration(xp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Sp{constructor(){this.value,this.dir,this.movement=new Cp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Pp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},_p=Phaser.Utils.Objects.GetValue;class Tp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=_p(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(_p(e,"speed",.1)),this.setEnable(_p(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(_p(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ep=Phaser.Utils.Objects.GetValue;var Mp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ep(s,l,void 0):Ep(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new gp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Ep(r,"position",0);"string"==typeof p&&(p=Rp[p]);var v,g,f=Ep(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ep(s,"space.slider",void 0))&&(a?f=0:v=Ep(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ep(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ep(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ep(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ep(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ep(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ep(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ep(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ep(s,"scrollDetectionMode");"string"==typeof b&&(b=Lp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Ep(s,x,!0):Ep(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new kp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Ep(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Tp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Rp={right:0,left:1,bottom:0,top:1},Lp={gameObject:0,rectBounds:1},Dp=Phaser.Utils.Objects.GetValue;var Yp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Dp(e,"width"),h=Dp(e,"height");n||Dp(e,"child.expandWidth",!0)||(s[1]=0),h||Dp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Xd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Wd(i,"child"),r=Wd(s,"gameObject",void 0);if(r){var n=Wd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),a.left=Wd(n,"left",0),a.right=Wd(n,"right",0);break;case 1:h.top=Wd(n,"left",0),h.bottom=Wd(n,"right",0),a.top=Wd(n,"top",0),a.bottom=Wd(n,"bottom",0);break;default:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),h.left=Wd(n,"left",0),h.right=Wd(n,"right",0)}e.add(r,{column:1,row:1,align:Wd(s,"align","center"),padding:a,expand:{width:Wd(s,"expandWidth",!0),height:Wd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Mp(t,a,"y",e);break;case 1:Mp(t,a,"x",e);break;default:Mp(t,a,"y",e),Mp(t,a,"x",e)}return a},Ap=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},zp=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Xp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(rv.prototype,tv);const nv=["top","bottom","centerY","center"],hv=["left","right","centerX","center"];var av=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=nv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=hv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ov=Phaser.Utils.Objects.GetValue;class lv extends Ip{constructor(t,e){void 0===e&&(e={});var i=md(e),s=ov(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ov(e,"clampChildOY",!1),s.clampChildOX=ov(e,"clampChildOX",!1);var r,n,h=new rv(t,s);switch(t.add.existing(h),i){case 0:r=ov(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ov(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:ov(e,"align.panel","center")};var a=ov(e,"space",void 0);a&&(a.child=ov(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Qn(this.childrenMap.child,t),this}}var dv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:av.call(this,t,"y",e);break;case 1:av.call(this,t,"x",e);break;default:av.call(this,t,"y",e),av.call(this,t,"x",e)}return this}};Object.assign(lv.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;var uv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=pv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=vv(e,this.listCreateSliderTrackCallback),v=vv(e,this.listCreateSliderThumbCallback);d=new lv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:cv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=pv(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},pv=function(t,e,i){var s;return i?(e.orientation="x",s=new gd(t,e)):(e.orientation="y",s=new Fl(t,e)),t.add.existing(s),s},vv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},gv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const yv={down:0,up:1},bv=Phaser.Utils.Objects.GetValue;class xv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mv(t,e),t.isRexSizer&&t.layout();var i=bv(e,"touchOutsideClose",!1),s=bv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Cv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Sv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=uv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new xv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Sv,bl,Cv);const wv=Phaser.Utils.Objects.GetValue;class Ov extends yl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(wv(e,"options"));var i=wv(e,"list");this.setWrapEnable(wv(i,"wrap",!1)),this.setCreateButtonCallback(wv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(wv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(wv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(wv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(wv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(wv(i,"scroller")),this.setListMouseWheelScrollerConfig(wv(i,"mouseWheelScroller")),this.setButtonClickCallback(wv(i,"onButtonClick")),this.setButtonOverCallback(wv(i,"onButtonOver")),this.setButtonOutCallback(wv(i,"onButtonOut")),this.setListExpandDirection(wv(i,"expandDirection")),this.setListEaseInDuration(wv(i,"easeIn",500)),this.setListEaseOutDuration(wv(i,"easeOut",100)),this.setListTransitInCallback(wv(i,"transitIn")),this.settListTransitOutCallback(wv(i,"transitOut")),this.setListMaxHeight(wv(i,"maxHeight",0)),this.setListSize(wv(i,"width"),wv(i,"height",0)),this.setListAlignmentMode(wv(i,"alignParent","text")),this.setListAlignmentSide(wv(i,"alignSide","")),this.setListBounds(wv(i,"bounds")),this.setListSpace(wv(i,"space")),this.setListDraggable(wv(i,"draggable",!1)),this.setValueChangeCallback(wv(e,"setValueCallback"),wv(e,"setValueCallbackScope")),this.setValue(wv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(Ov.prototype,Sv);const kv=Phaser.GameObjects.Text,Pv=Phaser.Utils.Objects.GetValue;class _v extends kv{constructor(t,e){void 0===e&&(e={}),super(t,Pv(e,"x",0),Pv(e,"y",0),Pv(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(_v.prototype,lc);var Tv=Phaser.Renderer.WebGL.Utils,Ev={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Tv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Mv=Phaser.Display.Canvas.CanvasPool;e();const Rv=Phaser.GameObjects.GameObject;class Lv extends Rv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Mv.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Mv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexsimplelabel.js b/dist/rexsimplelabel.js index 449f05577e..7d8fde27f5 100644 --- a/dist/rexsimplelabel.js +++ b/dist/rexsimplelabel.js @@ -12192,7 +12192,7 @@ var LayoutChildren$2 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$K(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$K(config, 'offsetX', 0); + offsetY = GetValue$K(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexsimplelabel.min.js b/dist/rexsimplelabel.min.js index 0f221d898c..7f19fa7dd3 100644 --- a/dist/rexsimplelabel.min.js +++ b/dist/rexsimplelabel.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class zi extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,As);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class js extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Cr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=Pn,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Xr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Xe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ch extends qn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,yh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Ph=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},_h={appendText:Ph,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Th extends Ch{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Th.prototype,_h);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ue(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ue(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Xh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Xh},Wh=function(t){return zh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=0,Nh=1,Gh=2,Vh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Vh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qh=Phaser.Display.Color;var ta={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ea=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ia={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ea(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=na(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Cs(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class la{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(la.prototype,oa);var da={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ca=Phaser.Math.RotateAround;var ua;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=e,s.y=i,0!==t.rotation&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ba=Phaser.GameObjects.Components.TransformMatrix;var xa,wa,Sa={},Ca=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Sa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new ba,wa=new ba),t.parentContainer?t.getWorldTransformMatrix(xa,wa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ca(t,e,n,h,r)},Pa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ua&&(ua={}),s=ua),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ca(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ta(this._rotation)}set angle(t){this.rotation=_a(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),za(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),za(t)},za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Wa=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ha=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Ga extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Va=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Va(t,"color2",null),Va(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Va(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;let Ja=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class co extends Ea{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){lo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class uo extends Ea{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class po extends Ea{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class vo extends la{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=go(t[i]));return e}var fo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mo={none:0,word:1,char:2,character:2,mix:3};var yo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=So.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=So.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oo(t,"wrapMode");void 0===c&&(c=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mo[c]);var u=Oo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=To(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=To(t,"maxLines",0);var a=0===i,o=To(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=To(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=To(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=To(t,"letterSpacing",0),p=To(t,"rtl",!0),v=To(t,"hAlign",p?2:0),g=To(t,"vAlign",0),f=fo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Oa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ll=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const dl=Phaser.Utils.Objects.GetValue,cl=Phaser.Utils.Objects.GetValue;class ul extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=cl(e,"background",void 0),r=cl(e,"icon",void 0),n=cl(e,"iconMask",void 0),h=cl(e,"text",void 0),a=cl(e,"action",void 0),o=cl(e,"actionMask",void 0),l=cl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:cl(e,"space.icon",0),top:cl(e,"space.iconTop",0),bottom:cl(e,"space.iconBottom",0),left:cl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:cl(e,"space.icon",0),left:cl(e,"space.iconLeft",0),right:cl(e,"space.iconRight",0),top:cl(e,"space.iconTop",0)});var d=cl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=cl(e,"iconSize",void 0);this.setIconSize(cl(e,"iconWidth",c),cl(e,"iconHeight",c))}}if(h){var u=cl(e,"wrapText",!1),p=cl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Wh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=cl(e,"space.text",0),m=cl(e,"expandTextWidth",!1),y=cl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:cl(e,"space.actionTop",0),bottom:cl(e,"space.actionBottom",0),right:cl(e,"space.actionRight",0)}:{left:cl(e,"space.actionLeft",0),right:cl(e,"space.actionRight",0),bottom:cl(e,"space.actionBottom",0)},d=cl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=cl(e,"actionSize");this.setActionSize(cl(e,"actionWidth",b),cl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},bl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const xl=Phaser.Renderer.Canvas.SetTransform;var wl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&vl(r,h,e,l,a,o),e.isStroked&&fl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(xl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Cl.prototype,wl);var Ol=function(t){return t.x>0&&t.y>0},Pl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const _l=Phaser.Math.DegToRad;var Tl=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const _d=Phaser.Utils.Objects.GetValue,Td=Phaser.Utils.Objects.IsPlainObject;class kd extends(Ql(Gl)){constructor(t,e,i,s,r,n,h,a){Td(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Td(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Td(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Od).setName("trackFill")).addShape((new Od).setName("bar")).addShape((new Od).setName("trackStroke")),this.setTrackColor(_d(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(_d(a,"trackStrokeThickness",2),_d(a,"trackStrokeColor",void 0)),this.setSkewX(_d(a,"skewX",0)),this.setRTL(_d(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ed={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Pd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Pd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Pd(a,0,0,e,i,t)}};Object.assign(kd.prototype,Ed);var Md=function(t){return null==t||""===t||0===t.length},Rd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Md(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Md(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=go(i),s=go(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Jd(t)?(this.stretchMode.edge=qd(Kd(t,"edge",0)),this.stretchMode.internal=qd(Kd(t,"internal",0))):(t=qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Qd.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ec=Phaser.Utils.Objects.IsPlainObject,ic=Phaser.Utils.Objects.GetValue,sc=Phaser.GameObjects;var rc=void 0,nc=function(t,e){if(rc||(rc={},qe(t).events.once("destroy",(function(){for(var t in rc)rc[t].destroy();rc=void 0}))),!rc.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new sc[e](i)).setOrigin(0),rc[e]=t}return rc[e]};const hc=Phaser.GameObjects.RenderTexture;class ac extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ec(i)?(i=ic(d=i,"x",0),s=ic(d,"y",0),r=ic(d,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(r)?(r=ic(d=r,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(h)?(h=ic(d=h,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(a)?(a=ic(d=a,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ic(d,"baseFrame",void 0)):ec(o)&&(o=ic(d=o,"columns",void 0),l=ic(d,"rows",void 0)),void 0===a&&(a=ic(d,"frame",void 0)),void 0===o){var c=ic(d,"leftWidth",void 0),u=ic(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ic(d,"topHeight",void 0),v=ic(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ic(d,"getFrameNameCallback",void 0)),this.setStretchMode(ic(d,"stretchMode",0)),this.setPreserveRatio(ic(d,"preserveRatio",!0));var g=ic(d,"maxFixedPartScale",1),f=ic(d,"maxFixedPartScaleX",g),m=ic(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,tc),i}(hc,"rexNinePatch")){}var oc={_drawImage:function(t,e,i,s,r,n){var h=nc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=nc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ac.prototype,oc);let lc=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Ad(t,e))return t[e];var i=t.parent;return Ad(i,e)?i[e]:void 0}set(t,e,i){return Ad(t,e)?t[e]=i:Ad(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const dc=Phaser.Utils.Objects.GetValue;class cc extends ac{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=dc(e,"effects",!0);i&&Fd(this,i),this.style=new lc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(cc.prototype,zl);const uc=["alpha","tint","flipX","flipY"];var pc=function(t,e){if(!e)return t;for(var i=0,s=uc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class zi extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,As);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class js extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Cr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=Pn,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Xr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Xe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ch extends qn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,yh);var Oh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Ph=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},_h={appendText:Ph,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Th extends Ch{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Oh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Oh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Th.prototype,_h);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ue(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ue(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Xh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Xh},Wh=function(t){return zh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Hh=0,Nh=1,Gh=2,Vh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Vh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=qh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Qh=Phaser.Display.Color;var ta={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Qh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},ea=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ia={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,ea(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=sa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=na(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){sa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Cs(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class la{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(la.prototype,oa);var da={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ca=Phaser.Math.RotateAround;var ua;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=e,s.y=i,0!==t.rotation&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ba=Phaser.GameObjects.Components.TransformMatrix;var xa,wa,Sa={},Ca=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Sa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new ba,wa=new ba),t.parentContainer?t.getWorldTransformMatrix(xa,wa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ca(t,e,n,h,r)},Pa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ua&&(ua={}),s=ua),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ca(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ta(this._rotation)}set angle(t){this.rotation=_a(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),za(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),za(t)},za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Wa=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ha=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Ga extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Va=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Va(t,"color2",null),Va(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Va(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const $a=Phaser.Utils.Objects.GetValue;let Ja=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ra(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=oo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),oo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class co extends Ea{constructor(t,e,i){super(t,Qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){lo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class uo extends Ea{constructor(t,e,i,s){super(t,to),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class po extends Ea{constructor(t,e){super(t,eo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class vo extends la{constructor(t,e,i,s,r){super(t,io),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=go(t[i]));return e}var fo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mo={none:0,word:1,char:2,character:2,mix:3};var yo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=So.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=So.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oo(t,"wrapMode");void 0===c&&(c=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mo[c]);var u=Oo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=To(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=To(t,"maxLines",0);var a=0===i,o=To(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=To(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=To(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=To(t,"letterSpacing",0),p=To(t,"rtl",!0),v=To(t,"hAlign",p?2:0),g=To(t,"vAlign",0),f=fo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ka(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return qa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Za);return null===i?i=new ho(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Oa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ll=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const dl=Phaser.Utils.Objects.GetValue,cl=Phaser.Utils.Objects.GetValue;class ul extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=cl(e,"background",void 0),r=cl(e,"icon",void 0),n=cl(e,"iconMask",void 0),h=cl(e,"text",void 0),a=cl(e,"action",void 0),o=cl(e,"actionMask",void 0),l=cl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:cl(e,"space.icon",0),top:cl(e,"space.iconTop",0),bottom:cl(e,"space.iconBottom",0),left:cl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:cl(e,"space.icon",0),left:cl(e,"space.iconLeft",0),right:cl(e,"space.iconRight",0),top:cl(e,"space.iconTop",0)});var d=cl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=cl(e,"iconSize",void 0);this.setIconSize(cl(e,"iconWidth",c),cl(e,"iconHeight",c))}}if(h){var u=cl(e,"wrapText",!1),p=cl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Wh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=cl(e,"space.text",0),m=cl(e,"expandTextWidth",!1),y=cl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:cl(e,"space.actionTop",0),bottom:cl(e,"space.actionBottom",0),right:cl(e,"space.actionRight",0)}:{left:cl(e,"space.actionLeft",0),right:cl(e,"space.actionRight",0),bottom:cl(e,"space.actionBottom",0)},d=cl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=cl(e,"actionSize");this.setActionSize(cl(e,"actionWidth",b),cl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},bl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const xl=Phaser.Renderer.Canvas.SetTransform;var wl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&vl(r,h,e,l,a,o),e.isStroked&&fl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(xl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Cl.prototype,wl);var Ol=function(t){return t.x>0&&t.y>0},Pl=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const _l=Phaser.Math.DegToRad;var Tl=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const _d=Phaser.Utils.Objects.GetValue,Td=Phaser.Utils.Objects.IsPlainObject;class kd extends(Ql(Gl)){constructor(t,e,i,s,r,n,h,a){Td(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Td(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Td(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Od).setName("trackFill")).addShape((new Od).setName("bar")).addShape((new Od).setName("trackStroke")),this.setTrackColor(_d(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(_d(a,"trackStrokeThickness",2),_d(a,"trackStrokeColor",void 0)),this.setSkewX(_d(a,"skewX",0)),this.setRTL(_d(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ed={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Pd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Pd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Pd(a,0,0,e,i,t)}};Object.assign(kd.prototype,Ed);var Md=function(t){return null==t||""===t||0===t.length},Rd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Md(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Md(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=go(i),s=go(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Jd(t)?(this.stretchMode.edge=qd(Kd(t,"edge",0)),this.stretchMode.internal=qd(Kd(t,"internal",0))):(t=qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Qd.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ec=Phaser.Utils.Objects.IsPlainObject,ic=Phaser.Utils.Objects.GetValue,sc=Phaser.GameObjects;var rc=void 0,nc=function(t,e){if(rc||(rc={},qe(t).events.once("destroy",(function(){for(var t in rc)rc[t].destroy();rc=void 0}))),!rc.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new sc[e](i)).setOrigin(0),rc[e]=t}return rc[e]};const hc=Phaser.GameObjects.RenderTexture;class ac extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ec(i)?(i=ic(d=i,"x",0),s=ic(d,"y",0),r=ic(d,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(r)?(r=ic(d=r,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(h)?(h=ic(d=h,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(a)?(a=ic(d=a,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ic(d,"baseFrame",void 0)):ec(o)&&(o=ic(d=o,"columns",void 0),l=ic(d,"rows",void 0)),void 0===a&&(a=ic(d,"frame",void 0)),void 0===o){var c=ic(d,"leftWidth",void 0),u=ic(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ic(d,"topHeight",void 0),v=ic(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(ic(d,"getFrameNameCallback",void 0)),this.setStretchMode(ic(d,"stretchMode",0)),this.setPreserveRatio(ic(d,"preserveRatio",!0));var g=ic(d,"maxFixedPartScale",1),f=ic(d,"maxFixedPartScaleX",g),m=ic(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,tc),i}(hc,"rexNinePatch")){}var oc={_drawImage:function(t,e,i,s,r,n){var h=nc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=nc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ac.prototype,oc);let lc=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Ad(t,e))return t[e];var i=t.parent;return Ad(i,e)?i[e]:void 0}set(t,e,i){return Ad(t,e)?t[e]=i:Ad(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const dc=Phaser.Utils.Objects.GetValue;class cc extends ac{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=dc(e,"effects",!0);i&&Fd(this,i),this.style=new lc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(cc.prototype,zl);const uc=["alpha","tint","flipX","flipY"];var pc=function(t,e){if(!e)return t;for(var i=0,s=uc.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexsizer.js b/dist/rexsizer.js index 196e5fd5e5..d4a4ff3777 100644 --- a/dist/rexsizer.js +++ b/dist/rexsizer.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$1(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$1(config, 'offsetX', 0); + offsetY = GetValue$1(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexsizer.min.js b/dist/rexsizer.min.js index 4bda623c38..e07ab0ffd5 100644 --- a/dist/rexsizer.min.js +++ b/dist/rexsizer.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new xi(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new xi(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new xi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ts={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Ts,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Gs=function(t,e){Yi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class xr extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new xr,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Tr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=xn,this.onDrag1Start();break;case xn:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case xn:this.tracerState=En,this.onDrag1End();break;case Pn:this.tracerState=xn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case xn:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const En=0,xn=1,Pn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},Tn={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Tn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ra[e];else if(ea(e)){var u;e=ia(u=e,"proportion",void 0),i=ia(u,"align",sa),s=ia(u,"padding",0),r=ia(u,"expand",!1),n=ia(u,"key",void 0),a=ia(u,"index",void 0),t.isRexSizer||(h=ia(u,"minWidth",void 0),o=ia(u,"minHeight",void 0)),l=ia(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}return Object.assign(ba.prototype,ga),ba},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexsizer=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Y=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Pe=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new xi(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new xi(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new xi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Xi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Fi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class Gi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Hi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Bi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Bi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Hi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Gi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Gi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ts={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ge(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Ts,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Xs=Phaser.GameObjects.Rectangle;class Ys extends Xs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Us extends Ys{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Bs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Gs=function(t,e){Fi(t,e,!1)},Hs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Bs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Gs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Hs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Vs.popUp;break;case qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Vs.scaleDown;break;case qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Hs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Hs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?fr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class xr extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new xr,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Tr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Br&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Vr=0,Br=1,Gr="IDLE",Hr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hr(t,"time",250)),this.setTapInterval(Hr(t,"tapInterval",200)),this.setDragThreshold(Hr(t,"threshold",9)),this.setTapOffset(Hr(t,"tapOffset",10));var e=Hr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hr(t,"maxTaps",void 0)),this.setMinTaps(Hr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ge(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=xn,this.onDrag1Start();break;case xn:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mn(this.pointers,e),this.tracerState){case xn:this.tracerState=En,this.onDrag1End();break;case Pn:this.tracerState=xn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case xn:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var Sn={};const En=0,xn=1,Pn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},Tn={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Tn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Xn}break;case Xn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Xn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Xn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t,e){return t.setInteractive(),Vn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vn(e,"targets",[t]),targetMode:Vn(e,"targetMode","parent"),eventEmitter:Vn(e,"eventEmitter",t),eventNamePrefix:Vn(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Xr.call(t,e),jr.call(t,e),Fn.call(t,e),jn.call(t,e),Un.call(t,e),t},Gn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ra[e];else if(ea(e)){var v;e=ia(v=e,"proportion",void 0),i=ia(v,"align",sa),s=ia(v,"padding",0),r=ia(v,"expand",!1),n=ia(v,"key",void 0),a=ia(v,"index",void 0),t.isRexSizer||(h=ia(v,"minWidth",void 0),o=ia(v,"minHeight",void 0)),l=ia(v,"fitRatio",0),d=ia(v,"offsetX",0),c=ia(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var fa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ma={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ma[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fa.call(this)),this._childrenProportion}}return Object.assign(ba.prototype,ga),ba},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexsizer=e(); diff --git a/dist/rexslider.js b/dist/rexslider.js index 82a0f0b3ff..d8b90d36e4 100644 --- a/dist/rexslider.js +++ b/dist/rexslider.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$c(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$c(config, 'offsetX', 0); + offsetY = GetValue$c(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexslider.min.js b/dist/rexslider.min.js index ad893ed602..1a420d6284 100644 --- a/dist/rexslider.min.js +++ b/dist/rexslider.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Wi),Bi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ki(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ki(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ki(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ki(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ws[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ws={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Vs extends Ys{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(xr(t,"enable",!0)),this.setCooldown(xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},kr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Ve);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=kn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Bn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Vn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Tt.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,ha,ua,ca,pa,va,fa);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Pa(r,a,e,l,h,o),e.isStroked&&xa(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ka(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ma.prototype,Da);const La=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){za(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ia=Phaser.Math.DegToRad;var Na=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Bh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Vh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ih(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Bh.prototype,Vh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return go.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const To=Phaser.Utils.Objects.GetValue;class Eo extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=To(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Eo.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Eo(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},we=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};const xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Me=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Xe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new wi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new wi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Wi),Bi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),ki(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),ki(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),ki(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),ki(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ms={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ws[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ws={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Vs extends Ys{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new _r(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class wr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const xr=Phaser.Utils.Objects.GetValue;class Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(xr(t,"enable",!0)),this.setCooldown(xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},kr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Ve);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=kn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Bn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Vn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l,d,u){pe.call(this,t);var c=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=na[e];else if(ia(e)){var v;e=sa(v=e,"proportion",void 0),i=sa(v,"align",ra),s=sa(v,"padding",0),r=sa(v,"expand",!1),n=sa(v,"key",void 0),a=sa(v,"index",void 0),t.isRexSizer||(h=sa(v,"minWidth",void 0),o=sa(v,"minHeight",void 0)),l=sa(v,"fitRatio",0),d=sa(v,"offsetX",0),u=sa(v,"offsetY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(c?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=u,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Tt.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,ha,ua,ca,pa,va,fa);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Pa(r,a,e,l,h,o),e.isStroked&&xa(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ka(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ma.prototype,Da);const La=Phaser.Utils.Objects.GetValue;let Aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){za(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ia=Phaser.Math.DegToRad;var Na=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Bh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Vh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ih(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Bh.prototype,Vh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return go.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const To=Phaser.Utils.Objects.GetValue;class Eo extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=To(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Eo.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Eo(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexsplitpanels.min.js b/dist/rexsplitpanels.min.js index 249774ef50..997c6c94c6 100644 --- a/dist/rexsplitpanels.min.js +++ b/dist/rexsplitpanels.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},O={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=E(t.scaleX,i.scaleX),e.scaleY=E(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=E(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Ee=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Te=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Oe={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,fi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(fi(t,"delay",0)),this.setDuration(fi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ei={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Pi(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Pi(t,a):n.resetFromJSON(a),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Oi=function(t){return Ti(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Oi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Oi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Oi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Pi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Oi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Oi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Oi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Oi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Vi=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Vi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Vi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Oi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Oi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Oi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Oi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Oi(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ti(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Os={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Os,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ts(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Bs extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Vs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Hs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Vs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Hs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Gs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Us.popUp;break;case qs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Us.scaleDown;break;case qs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!fr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Tr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Or=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Vr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Ur=0,Vr=1,Hr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,fn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],fn(this.pointers,e),this.tracerState){case Pn:this.tracerState=xn,this.onDrag1End();break;case En:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Be);var Sn={};const xn=0,Pn=1,En=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var Tn=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},On={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=On),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Ot(t)},getChildPrevState:function(t){var e=Ot(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ra[e];else if(ea(e)){var u;e=ia(u=e,"proportion",void 0),i=ia(u,"align",sa),s=ia(u,"padding",0),r=ia(u,"expand",!1),n=ia(u,"key",void 0),a=ia(u,"index",void 0),t.isRexSizer||(h=ia(u,"minWidth",void 0),o=ia(u,"minHeight",void 0)),l=ia(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Tt.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,m=u,f=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},fa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=fa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);const Sa=Phaser.Utils.Objects.GetValue,xa=Phaser.Math.Distance.Between,Pa=Phaser.Math.RotateAroundDistance;class Ea extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this._enable=void 0,t.setInteractive(Sa(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.setEnable(Sa(t,"enable",!0)),this.setAxisMode(Sa(t,"axis",0)),this.setAxisRotation(Sa(t,"rotation",0)),this}toJSON(){return{enable:this.enable,axis:this.axisMode,rotation:this.axisRotation}}boot(){var t=this.parent;t.on("dragstart",this.onDragStart,this),t.on("drag",this.onDrag,this),t.on("dragend",this.onDragEnd,this)}shutdown(t){this.isShutdown||(this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragend(),this._enable=t,this.scene.input.setDraggable(this.parent,t),this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setAxisMode(t){return"string"==typeof t&&(t=_a[t]),this.axisMode=t,this}setAxisRotation(t){return this.axisRotation=t,this}drag(){return function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&C0&&b=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const w=Phaser.Math.DegToRad;var O={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=w(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=E(t.scaleX,i.scaleX),e.scaleY=E(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=E(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const N=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Ee=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var we=function(t,e){return void 0===e?t:t[e]},Oe=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Te={getInnerPadding(t){return we(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return we(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),we(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,fi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(fi(t,"delay",0)),this.setDuration(fi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const bi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ei={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Pi(t,h):r.resetFromJSON(h),r.restart(),r},wi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Pi(t,a):n.resetFromJSON(a),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=wi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Pi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,Di),Ri.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ii extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,ji),Wi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Vi=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Vi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Vi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const as=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new os(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Oi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ts={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ks={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ds={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Rs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ms={};Object.assign(Ms,Ts,ks,Ds,Rs);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ms);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class As extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Xs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ys=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Ws=Phaser.Utils.Objects.GetValue;class Bs extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){wi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Vs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Hs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Vs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Hs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),a=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Gs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.popUp:t=Us.popUp;break;case qs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Us.scaleDown;break;case qs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!fr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:sr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ws{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Or={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Tr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Vr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Ur=0,Vr=1,Hr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qr},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new ws(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var hn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Br{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=pn},eventEmitter:!1};this.setRecongizedStateObject(new ws(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(un.prototype,hn);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,fn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=He(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=xn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],fn(this.pointers,e),this.tracerState){case Pn:this.tracerState=xn,this.onDrag1End();break;case En:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=xn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Be);var Sn={};const xn=0,Pn=1,En=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const wn=Phaser.Math.RotateAround;var On=function(t,e,i,s){return wn(t,e,i,s),t.rotation+=s,t},Tn={};const kn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Rn=Phaser.Math.Angle.ShortestBetween,Mn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Tn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Mn(this.angleBetween));this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Mn(this.angleBetween)),this.angle=Rn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const In="IDLE",An="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Rr.call(t,e),zr.call(t,e),Fr.call(t,e),jr.call(t,e),Yn.call(t,e),jn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",he),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(a=ne(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Display.Align.CENTER,ra={min:0,full:-1};var na=function(t,e,i,s,r,n,a,h,o,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ra[e];else if(ea(e)){var v;e=ia(v=e,"proportion",void 0),i=ia(v,"align",sa),s=ia(v,"padding",0),r=ia(v,"expand",!1),n=ia(v,"key",void 0),a=ia(v,"index",void 0),t.isRexSizer||(h=ia(v,"minWidth",void 0),o=ia(v,"minHeight",void 0)),l=ia(v,"fitRatio",0),d=ia(v,"offsetX",0),c=ia(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=sa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},aa={add:na,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),na.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ea(i)&&(i.index=t),na.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ta.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ha=Ot.prototype.clear;var oa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ha.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,oa.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ua={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},pa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},va={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ye(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,m=u,f=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ga,aa,da,ca,ua,pa,va);var ma=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},fa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ya=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class ba extends Jn{constructor(t,e,i,s,r,n,a){ya(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ya(n)&&(n=Ca(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=fa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ma.call(this)),this._childrenProportion}}Object.assign(ba.prototype,ga);const Sa=Phaser.Utils.Objects.GetValue,xa=Phaser.Math.Distance.Between,Pa=Phaser.Math.RotateAroundDistance;class Ea extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this._enable=void 0,t.setInteractive(Sa(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.setEnable(Sa(t,"enable",!0)),this.setAxisMode(Sa(t,"axis",0)),this.setAxisRotation(Sa(t,"rotation",0)),this}toJSON(){return{enable:this.enable,axis:this.axisMode,rotation:this.axisRotation}}boot(){var t=this.parent;t.on("dragstart",this.onDragStart,this),t.on("drag",this.onDrag,this),t.on("dragend",this.onDragEnd,this)}shutdown(t){this.isShutdown||(this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragend(),this._enable=t,this.scene.input.setDraggable(this.parent,t),this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setAxisMode(t){return"string"==typeof t&&(t=_a[t]),this.axisMode=t,this}setAxisRotation(t){return this.axisRotation=t,this}drag(){return function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&C0&&b= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -15820,6 +15836,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rextabpages.min.js b/dist/rextabpages.min.js index 7a74e52ec5..29d465ad33 100644 --- a/dist/rextabpages.min.js +++ b/dist/rextabpages.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},z={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const we=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Te={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,o):r.resetFromJSON(o),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return _i(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var o,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,zi),Ri.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,Di=Phaser.Math.Linear;class Ii extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Di(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},ji=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Wi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Fi={};Object.assign(Fi,Ni),Fi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ui&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Ji(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Ji(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new Ui(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ui&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Ji(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Ji(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new Ui(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Zi={};Object.assign(Zi,qi),Zi.onInitEaseMove=function(){qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,Rs,Ms,Ls,Ds);const As=Phaser.Utils.Objects.GetValue;class Ys extends qe{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Is);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class js extends qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Ns extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new js(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Bs extends qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends Ns{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){ji(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},$s=function(t,e){ji(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Zs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Js)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Ks(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Er[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Er={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Jr=0,$r=1,Kr="IDLE",qr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(qr(t,"time",250)),this.setTapInterval(qr(t,"tapInterval",200)),this.setDragThreshold(qr(t,"threshold",9)),this.setTapOffset(qr(t,"tapOffset",10));var e=qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(qr(t,"maxTaps",void 0)),this.setMinTaps(qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(wn.prototype,Be);var En={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Yn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(An(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Dn(An(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const jn="IDLE",Wn="BEGIN",Nn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ir.call(t,e),Xr.call(t,e),Nr.call(t,e),Hr.call(t,e),Bn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},Kn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,o=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",oe),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(h=ne(a,"align","left-top"))&&(h=Dt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return lh(this.sizerChildren,null),ah.call(this,t),this}},ch={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},yh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h,o,a,l){bh(e)?(e=Ch(l=e,"x",0),i=Ch(l,"y",0),s=Ch(l,"width",void 0),r=Ch(l,"height",void 0),n=Ch(l,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(s)?(s=Ch(l=s,"width",void 0),r=Ch(l,"height",void 0),n=Ch(l,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(n)?(n=Ch(l=n,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(o)&&(o=Ch(l=o,"columnProportions",0),a=Ch(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ch(l,"createCellContainerCallback")),this.setIndentLeft(Ch(l,"space.indentLeftOdd",0),Ch(l,"space.indentLeftEven",0)),this.setIndentTop(Ch(l,"space.indentTopOdd",0),Ch(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Ch(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=mh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=yh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(xh.prototype,fh);const Sh=Phaser.Math.Wrap;var Ph=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,h=0,o=n.length;h(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue,kh=Phaser.Display.Align.CENTER,zh={min:0,full:-1};var Rh=function(t,e,i,s,r,n,h,o,a,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=zh[e];else if(_h(e)){var u;e=Th(u=e,"proportion",void 0),i=Th(u,"align",kh),s=Th(u,"padding",0),r=Th(u,"expand",!1),n=Th(u,"key",void 0),h=Th(u,"index",void 0),t.isRexSizer||(o=Th(u,"minWidth",void 0),a=Th(u,"minHeight",void 0)),l=Th(u,"fitRatio",0)}return"string"==typeof i&&(i=Dt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=kh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Mh={add:Rh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Rh.call(this,new Eh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return _h(i)&&(i.index=t),Rh.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=Oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const Lh=Phaser.Utils.Array.Remove;var Dh={remove(t,e){return this.getParentSizer(t)!==this||(Lh(this.sizerChildren,t),be.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ah.call(this,t),this}},Ih={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Dt[e]),this.getSizerConfig(t).align=e,this}},Ah={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(je(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Ph.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Ph.call(this,void 0,t),De.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Xh,Mh,Dh,Ih,Ah,Yh,gh);var jh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Nh=function(t){return"string"==typeof t&&(t=Wh[t]),t};const Fh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Gh extends Zn{constructor(t,e,i,s,r,n,h){Fh(e)?(e=Bh(h=e,"x",0),i=Bh(h,"y",0),s=Bh(h,"width",void 0),r=Bh(h,"height",void 0),n=Bh(h,"orientation",0)):Fh(s)?(s=Bh(h=s,"width",void 0),r=Bh(h,"height",void 0),n=Bh(h,"orientation",0)):Fh(n)&&(n=Bh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Bh(h,"space.item",0)),this.setStartChildIndex(Bh(h,"startChildIndex",0)),this.setRTL(Bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Nh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=jh.call(this)),this._childrenProportion}}Object.assign(Gh.prototype,Xh);const Hh=Gh.prototype.add,Uh=Gh.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Uh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Uh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Jh={addButton(t){if(or(t))for(var e=t,i=0,s=e.length;i=0;i--)qh.call(this,e[i],t);return this}},Qh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},to=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Qh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eo={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),to.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(a=fo(o.left,o.centerY,t,e))&&(r=a,s=n);var a,l=i[n+1];l&&l.y===o.y||r>(a=fo(o.right,o.centerY,t,e))&&(r=a,s=n+1)}}return s};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.Display.Align.CENTER;var xo=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ue.call(this,t),yo(e)&&(e=bo(r=e,"padding",0),i=bo(r,"key",void 0),s=bo(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Co,r.padding=de(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},So={add(t,e,i){if(or(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ah.call(this,t),this}},Eo={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Mo.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Yo.call(this,e[i],t);return this}};const jo=Phaser.Utils.Objects.GetValue;class Wo extends zo{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new ao({parent:this,eventEmitter:jo(e,"eventEmitter",this),groupName:jo(e,"groupName",void 0),clickConfig:jo(e,"click",void 0)}).setButtonsType(e);var s=jo(e,"background",void 0),r=jo(e,"buttons",void 0);this.buttonsAlign=jo(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Wo.prototype,Do,Xo,oo,co);var No=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Fo[i])}void 0===s?s={}:!0===s&&(s=Bo);var n=e.width/t.width,h=e.height/t.height,o=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*o,s.height=t.height*o,s};const Fo={fit:0,FIT:0,envelop:1,ENVELOP:1};var Bo={},Go={},Ho={};const Uo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue,Jo=Phaser.Display.Align.CENTER,$o=Phaser.Utils.String.UUID;var Ko={add:function(t,e,i,s,r,n,h,o,a,l){ue.call(this,t),Uo(e)&&(e=Vo(d=e,"key",void 0),i=Vo(d,"align",Jo),s=Vo(d,"padding",0),r=Vo(d,"expand",!0),t.isRexSizer||(n=Vo(d,"minWidth",t._minWidth),h=Vo(d,"minHeight",t._minHeighted)),o=Vo(d,"offsetX",0),a=Vo(d,"offsetY",0),l=Vo(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=$o()),"string"==typeof i&&(i=Dt[i]),void 0===i&&(i=Jo),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===o&&(o=0),void 0===a&&(a=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Uo(r)?(d.expandWidth=Vo(r,"width",!1),d.expandHeight=Vo(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=o,d.alignOffsetY=a,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},qo={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),be.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ah.call(this,t),this}},Zo={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,o,a,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ur.call(this,t),o=this.getExpandedChildWidth(t),a=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Go.width=e.aspectRatio,Go.height=1,Ho.width=o,Ho.height=a,o=(l=No(Go,Ho,"FIT",!0)).width,a=l.height),t.isRexSizer?(t.runLayout(this,o,a),eh(t,this)):je(t,o,a),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,pr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Zo,Ko,qo);const Qo=Phaser.Utils.Objects.IsPlainObject,ta=Phaser.Utils.Objects.GetValue;class ea extends Zn{constructor(t,e,i,s,r,n){Qo(e)?(e=ta(n=e,"x",0),i=ta(n,"y",0),s=ta(n,"width",void 0),r=ta(n,"height",void 0)):Qo(s)&&(s=ta(n=s,"width",void 0),r=ta(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ea.prototype,Zo);const ia=ea.prototype.add;var sa=function(t,e,i,s,r,n,h,o,a){return t.setVisible(!1),ia.call(this,t,e,i,s,r,n,h,o,a),this},ra={add:sa,addPage:sa};const na=_t.prototype.setChildVisible;var ha={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(na.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(na.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(ha,ra);const oa=Phaser.Utils.Objects.GetValue;class aa extends ea{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(oa(e,"swapMode",0)),this.setFadeInDuration(oa(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=la[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(aa.prototype,ha);const la={invisible:0,destroy:1},da=Phaser.Utils.Objects.IsPlainObject,ca=Phaser.Utils.Objects.GetValue,ua=Phaser.Utils.String.UUID;var pa={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},va={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ga={top:1,left:3,right:5,bottom:7},fa={top:"bottom",left:"right",right:"left",bottom:"top"},ma={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},ya={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},z={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},I=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},X=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const we=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Te={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Re=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Me=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,o):r.resetFromJSON(o),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ti=function(t){return _i(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ti(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ti(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ti(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var o,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ti(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ri={};Object.assign(Ri,zi),Ri.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Mi=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,Di=Phaser.Math.Linear;class Ii extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Mi(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Di(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Xi=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},ji=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Wi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ti(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Wi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=ji(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ti(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ti(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Fi={};Object.assign(Fi,Ni),Fi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,Ki=Phaser.Math.Distance.Between;var qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ui&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Ji(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Ji(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new Ui(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ti(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ti(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ki(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ui&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Ji(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Ji(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new Ui(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ti(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ti(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Zi={};Object.assign(Zi,qi),Zi.onInitEaseMove=function(){qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ti(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},us=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,Rs,Ms,Ls,Ds);const As=Phaser.Utils.Objects.GetValue;class Ys extends qe{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Is);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class js extends qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Ns extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new js(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Bs extends qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends Ns{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){ji(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},$s=function(t,e){ji(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Zs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Js)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Ks(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Er[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Er={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Jr=0,$r=1,Kr="IDLE",qr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(qr(t,"time",250)),this.setTapInterval(qr(t,"tapInterval",200)),this.setDragThreshold(qr(t,"threshold",9)),this.setTapOffset(qr(t,"tapOffset",10));var e=qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(qr(t,"maxTaps",void 0)),this.setMinTaps(qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(wn.prototype,Be);var En={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,Yn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(An(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Dn(An(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const jn="IDLE",Wn="BEGIN",Nn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Ir.call(t,e),Xr.call(t,e),Nr.call(t,e),Hr.call(t,e),Bn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},Kn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,o=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",oe),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(h=ne(a,"align","left-top"))&&(h=Dt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return lh(this.sizerChildren,null),ah.call(this,t),this}},ch={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},yh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const bh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h,o,a,l){bh(e)?(e=Ch(l=e,"x",0),i=Ch(l,"y",0),s=Ch(l,"width",void 0),r=Ch(l,"height",void 0),n=Ch(l,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(s)?(s=Ch(l=s,"width",void 0),r=Ch(l,"height",void 0),n=Ch(l,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(n)?(n=Ch(l=n,"column",l.col||0),h=Ch(l,"row",0),o=Ch(l,"columnProportions",0),a=Ch(l,"rowProportions",0)):bh(o)&&(o=Ch(l=o,"columnProportions",0),a=Ch(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ch(l,"createCellContainerCallback")),this.setIndentLeft(Ch(l,"space.indentLeftOdd",0),Ch(l,"space.indentLeftEven",0)),this.setIndentTop(Ch(l,"space.indentTopOdd",0),Ch(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Ch(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=mh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=yh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(xh.prototype,fh);const Sh=Phaser.Math.Wrap;var Ph=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,h=0,o=n.length;h(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue,kh=Phaser.Display.Align.CENTER,zh={min:0,full:-1};var Rh=function(t,e,i,s,r,n,h,o,a,l,d,c){ue.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=zh[e];else if(_h(e)){var v;e=Th(v=e,"proportion",void 0),i=Th(v,"align",kh),s=Th(v,"padding",0),r=Th(v,"expand",!1),n=Th(v,"key",void 0),h=Th(v,"index",void 0),t.isRexSizer||(o=Th(v,"minWidth",void 0),a=Th(v,"minHeight",void 0)),l=Th(v,"fitRatio",0),d=Th(v,"offsetX",0),c=Th(v,"offsetY",0)}return"string"==typeof i&&(i=Dt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=kh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Mh={add:Rh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Rh.call(this,new Eh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return _h(i)&&(i.index=t),Rh.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=Oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const Lh=Phaser.Utils.Array.Remove;var Dh={remove(t,e){return this.getParentSizer(t)!==this||(Lh(this.sizerChildren,t),be.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ah.call(this,t),this}},Ih={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Dt[e]),this.getSizerConfig(t).align=e,this}},Ah={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(je(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Me.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Ph.call(this,t,void 0),Re.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Ph.call(this,void 0,t),De.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Xh,Mh,Dh,Ih,Ah,Yh,gh);var jh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Nh=function(t){return"string"==typeof t&&(t=Wh[t]),t};const Fh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Gh extends Zn{constructor(t,e,i,s,r,n,h){Fh(e)?(e=Bh(h=e,"x",0),i=Bh(h,"y",0),s=Bh(h,"width",void 0),r=Bh(h,"height",void 0),n=Bh(h,"orientation",0)):Fh(s)?(s=Bh(h=s,"width",void 0),r=Bh(h,"height",void 0),n=Bh(h,"orientation",0)):Fh(n)&&(n=Bh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Bh(h,"space.item",0)),this.setStartChildIndex(Bh(h,"startChildIndex",0)),this.setRTL(Bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Nh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=jh.call(this)),this._childrenProportion}}Object.assign(Gh.prototype,Xh);const Hh=Gh.prototype.add,Uh=Gh.prototype.addSpace;var Vh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Uh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Uh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Jh={addButton(t){if(or(t))for(var e=t,i=0,s=e.length;i=0;i--)qh.call(this,e[i],t);return this}},Qh=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},to=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Qh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eo={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),to.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(a=fo(o.left,o.centerY,t,e))&&(r=a,s=n);var a,l=i[n+1];l&&l.y===o.y||r>(a=fo(o.right,o.centerY,t,e))&&(r=a,s=n+1)}}return s};const yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.Display.Align.CENTER;var xo=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ue.call(this,t),yo(e)&&(e=bo(r=e,"padding",0),i=bo(r,"key",void 0),s=bo(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Co,r.padding=de(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},So={add(t,e,i){if(or(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ah.call(this,t),this}},Eo={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Mo.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Yo.call(this,e[i],t);return this}};const jo=Phaser.Utils.Objects.GetValue;class Wo extends zo{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new ao({parent:this,eventEmitter:jo(e,"eventEmitter",this),groupName:jo(e,"groupName",void 0),clickConfig:jo(e,"click",void 0)}).setButtonsType(e);var s=jo(e,"background",void 0),r=jo(e,"buttons",void 0);this.buttonsAlign=jo(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Wo.prototype,Do,Xo,oo,co);var No=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Fo[i])}void 0===s?s={}:!0===s&&(s=Bo);var n=e.width/t.width,h=e.height/t.height,o=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*o,s.height=t.height*o,s};const Fo={fit:0,FIT:0,envelop:1,ENVELOP:1};var Bo={},Go={},Ho={};const Uo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue,Jo=Phaser.Display.Align.CENTER,$o=Phaser.Utils.String.UUID;var Ko={add:function(t,e,i,s,r,n,h,o,a,l){ue.call(this,t),Uo(e)&&(e=Vo(d=e,"key",void 0),i=Vo(d,"align",Jo),s=Vo(d,"padding",0),r=Vo(d,"expand",!0),t.isRexSizer||(n=Vo(d,"minWidth",t._minWidth),h=Vo(d,"minHeight",t._minHeighted)),o=Vo(d,"offsetX",0),a=Vo(d,"offsetY",0),l=Vo(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=$o()),"string"==typeof i&&(i=Dt[i]),void 0===i&&(i=Jo),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===o&&(o=0),void 0===a&&(a=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Uo(r)?(d.expandWidth=Vo(r,"width",!1),d.expandHeight=Vo(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=o,d.alignOffsetY=a,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},qo={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),be.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ah.call(this,t),this}},Zo={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,o,a,l,d=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ur.call(this,t),o=this.getExpandedChildWidth(t),a=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Go.width=e.aspectRatio,Go.height=1,Ho.width=o,Ho.height=a,o=(l=No(Go,Ho,"FIT",!0)).width,a=l.height),t.isRexSizer?(t.runLayout(this,o,a),eh(t,this)):je(t,o,a),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,pr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Zo,Ko,qo);const Qo=Phaser.Utils.Objects.IsPlainObject,ta=Phaser.Utils.Objects.GetValue;class ea extends Zn{constructor(t,e,i,s,r,n){Qo(e)?(e=ta(n=e,"x",0),i=ta(n,"y",0),s=ta(n,"width",void 0),r=ta(n,"height",void 0)):Qo(s)&&(s=ta(n=s,"width",void 0),r=ta(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ea.prototype,Zo);const ia=ea.prototype.add;var sa=function(t,e,i,s,r,n,h,o,a){return t.setVisible(!1),ia.call(this,t,e,i,s,r,n,h,o,a),this},ra={add:sa,addPage:sa};const na=_t.prototype.setChildVisible;var ha={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(na.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(na.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(ha,ra);const oa=Phaser.Utils.Objects.GetValue;class aa extends ea{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(oa(e,"swapMode",0)),this.setFadeInDuration(oa(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=la[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(aa.prototype,ha);const la={invisible:0,destroy:1},da=Phaser.Utils.Objects.IsPlainObject,ca=Phaser.Utils.Objects.GetValue,ua=Phaser.Utils.String.UUID;var pa={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},va={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ga={top:1,left:3,right:5,bottom:7},fa={top:"bottom",left:"right",right:"left",bottom:"top"},ma={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},ya={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextabs.min.js b/dist/rextabs.min.js index 19463ea938..86b49d24d8 100644 --- a/dist/rextabs.min.js +++ b/dist/rextabs.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},B={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},z={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},M={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},D=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},N=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const we=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},Te=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},_e={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Me=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},De={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ci:ui,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ci))}get t(){var t;switch(this.state){case di:case ui:case pi:t=0;break;case ci:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=ci,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ui}get isCountDown(){return this.state===ci}get isRunning(){return this.state===ui||this.state===ci}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ui=1,ci=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var h={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new xi(t,h):r.resetFromJSON(h),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new xi(t,o):n.resetFromJSON(o),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return Ti(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var h,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},a={x:i};break;case 1:case"y":h={y:t.scaleX},a={y:i};break;default:h=t.scaleX,a=i}var l={mode:2,start:h,end:a,duration:e/2,ease:n,repeat:s};return void 0===o?o=new xi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Bi),zi.onInitScale=function(){Bi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Mi=Phaser.Utils.Objects.GetAdvancedValue,Li=Phaser.Math.Linear;class Di extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Mi(t,"start",this.parent.alpha),Mi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Li(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Di(t,o):s.resetFromJSON(o),s.restart(),s},Xi=function(t,e,i,s){i instanceof Di&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Di(t,r):s.resetFromJSON(r),s.restart(),s};const Yi=Phaser.Utils.Objects.IsPlainObject;var Fi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},ji={};Object.assign(ji,Fi),ji.onInitFade=function(){Fi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const os=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ti(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},cs=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Dt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Dt),this.transitOutCallback=t,this}},Ms={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ds={};Object.assign(Ds,zs,Rs,Ms,Ls);const As=Phaser.Utils.Objects.GetValue;class Is extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Bs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,Ds);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ns(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,h=r/2,a=n/2,l=r*o,d=n*o;e.x===h&&e.y===a||e.setPosition(h,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class Fs extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const js=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(js(t,"hitAreaMode",0)),this.setEnable(js(t,"enable",!0)),this.setStopMode(js(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,a=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,h=n.pointers,a=0;a0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Br={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,un);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case Tn:this.tracerState=On,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,We);var Pn={};const On=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Bn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Bn(t,e,i,s),t.rotation+=s,t},Rn={};const Mn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,h=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(An(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Ln(An(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Xn="IDLE",Yn="BEGIN",Fn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Dr.call(t,e),Nr.call(t,e),Fr.call(t,e),Hr.call(t,e),Wn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=zt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",he),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(o=ne(a,"align","left-top"))&&(o=Lt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return lo(this.sizerChildren,null),ao.call(this,t),this}},co={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)lo(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},fo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},mo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,lo(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)lo(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},bo=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Co=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue;class Eo extends Kn{constructor(t,e,i,s,r,n,o,h,a,l){Co(e)?(e=So(l=e,"x",0),i=So(l,"y",0),s=So(l,"width",void 0),r=So(l,"height",void 0),n=So(l,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(s)?(s=So(l=s,"width",void 0),r=So(l,"height",void 0),n=So(l,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(n)?(n=So(l=n,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(h)&&(h=So(l=h,"columnProportions",0),a=So(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(So(l,"createCellContainerCallback")),this.setIndentLeft(So(l,"space.indentLeftOdd",0),So(l,"space.indentLeftEven",0)),this.setIndentTop(So(l,"space.indentTopOdd",0),So(l,"space.indentTopEven",0)),this.resetGrid(n,o,h,a,So(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=yo.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=bo.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Eo.prototype,mo);const xo=Phaser.Math.Wrap;var wo=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,o=0,h=n.length;o(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=o)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=o+1),r};const _o=Phaser.Utils.Objects.IsPlainObject,ko=Phaser.Utils.Objects.GetValue,Bo=Phaser.Display.Align.CENTER,zo={min:0,full:-1};var Ro=function(t,e,i,s,r,n,o,h,a,l){ce.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=zo[e];else if(_o(e)){var c;e=ko(c=e,"proportion",void 0),i=ko(c,"align",Bo),s=ko(c,"padding",0),r=ko(c,"expand",!1),n=ko(c,"key",void 0),o=ko(c,"index",void 0),t.isRexSizer||(h=ko(c,"minWidth",void 0),a=ko(c,"minHeight",void 0)),l=ko(c,"fitRatio",0)}return"string"==typeof i&&(i=Lt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=Bo),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=de(s),c.expand=r,c.fitRatio=0===e?l:0,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},Mo={add:Ro,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Ro.call(this,new Oo(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,h){return _o(i)&&(i.index=t),Ro.call(this,e,i,s,r,n,o,t,h),this},insertAtPosition(t,e,i,s,r,n,o,h,a){var l=To.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,h,a),this}};const Lo=Phaser.Utils.Array.Remove;var Do={remove(t,e){return this.getParentSizer(t)!==this||(Lo(this.sizerChildren,t),be.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ao.call(this,t),this}},Ao={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Lt[e]),this.getSizerConfig(t).align=e,this}},Io={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},No={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Xo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,o+=n)))}return a?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,h,a,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=u,f=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Be.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&wo.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Me.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&wo.call(this,void 0,t),Le.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Xo,Mo,Do,Ao,Io,No,fo);var Yo=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const jo=Phaser.Utils.Objects.IsPlainObject,Wo=Phaser.Utils.Objects.GetValue;class Go extends Kn{constructor(t,e,i,s,r,n,o){jo(e)?(e=Wo(o=e,"x",0),i=Wo(o,"y",0),s=Wo(o,"width",void 0),r=Wo(o,"height",void 0),n=Wo(o,"orientation",0)):jo(s)?(s=Wo(o=s,"width",void 0),r=Wo(o,"height",void 0),n=Wo(o,"orientation",0)):jo(n)&&(n=Wo(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Wo(o,"space.item",0)),this.setStartChildIndex(Wo(o,"startChildIndex",0)),this.setRTL(Wo(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Fo[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Yo.call(this)),this._childrenProportion}}Object.assign(Go.prototype,Xo);const Ho=Go.prototype.add,Uo=Go.prototype.addSpace;var Vo=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Uo.call(this),Ho.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Uo.call(this),this.hasTailSpace=s}else Ho.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ho.call(this,t,{index:r,proportion:i,expand:!0})}else Ho.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Jo={addButton(t){if(hr(t))for(var e=t,i=0,s=e.length;i=0;i--)Zo.call(this,e[i],t);return this}},Qo=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},th=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Qo.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eh={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),th.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},B={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},z={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},M={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},D=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},N=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},xe=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const we=/(\S+)\[(\d+)\]/i,Pe=Phaser.Utils.Objects.GetValue;var Oe=function(t,e){return void 0===e?t:t[e]},Te=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Pe(e,"left",0),t.right=Pe(e,"right",0),t.top=Pe(e,"top",0),t.bottom=Pe(e,"bottom",0)),t},_e={getInnerPadding(t){return Oe(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Oe(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},ke=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Re=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Me=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},De={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?ci:ui,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ci))}get t(){var t;switch(this.state){case di:case ui:case pi:t=0;break;case ci:t=this.nowTime/this.duration;break;case vi:t=1}return ai(t,0,1)}set t(t){(t=ai(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=ci,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ui}get isCountDown(){return this.state===ci}get isRunning(){return this.state===ui||this.state===ci}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ui=1,ci=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;class xi extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Pi=function(t,e,i,s,r){var n,o;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},o={x:t.scaleX};break;case 1:case"y":n={y:0},o={y:t.scaleY};break;default:n=0,o=t.scale}var h={mode:0,start:n,end:o,duration:e,ease:s};return void 0===r?r=new xi(t,h):r.resetFromJSON(h),r.restart(),r},Oi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof xi&&(n=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=s,void 0===n?n=new xi(t,o):n.resetFromJSON(o),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},_i=function(t){return Ti(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Pi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),_i(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),_i(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),_i(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,o){var h,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},a={x:i};break;case 1:case"y":h={y:t.scaleX},a={y:i};break;default:h=t.scaleX,a=i}var l={mode:2,start:h,end:a,duration:e/2,ease:n,repeat:s};return void 0===o?o=new xi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,s,r,this._scaleBehavior),o&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),_i(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Bi),zi.onInitScale=function(){Bi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ri=Phaser.Utils.Objects.GetValue,Mi=Phaser.Utils.Objects.GetAdvancedValue,Li=Phaser.Math.Linear;class Di extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ri(t,"mode",0)),this.setAlphaRange(Mi(t,"start",this.parent.alpha),Mi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Li(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var o={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Di(t,o):s.resetFromJSON(o),s.restart(),s},Xi=function(t,e,i,s){i instanceof Di&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Di(t,r):s.resetFromJSON(r),s.restart(),s};const Yi=Phaser.Utils.Objects.IsPlainObject;var Fi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),_i(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Yi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),_i(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),_i(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},ji={};Object.assign(ji,Fi),ji.onInitFade=function(){Fi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ui extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Ji(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Ji(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),_i(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),_i(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,o){n instanceof Ui&&(o=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Ji(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Ji(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new Ui(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,s,r,this._easeMove),o&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),_i(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),_i(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=Qi(i,"magnitude",void 0),t=Qi(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,o=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=o;break;default:i.x=n,i.y=o}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),_i(this._shake)}};const os=Phaser.Utils.Objects.GetValue,hs=Phaser.Math.Linear;class as extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=hs(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new as(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ls(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ti(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},cs=Phaser.Utils.Array.Remove,ps={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ue(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Dt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Dt),this.transitOutCallback=t,this}},Ms={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ds={};Object.assign(Ds,zs,Rs,Ms,Ls);const As=Phaser.Utils.Objects.GetValue;class Is extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Bs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,Ds);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Ns(e):t};class Xs extends Ze{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,o=1/i.zoom,h=r/2,a=n/2,l=r*o,d=n*o;e.x===h&&e.y===a||e.setPosition(h,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ys=Phaser.GameObjects.Rectangle;class Fs extends Ys{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const js=Phaser.Utils.Objects.GetValue;class Ws extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(js(t,"hitAreaMode",0)),this.setEnable(js(t,"enable",!0)),this.setStopMode(js(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Pi(t,e)},scaleDown(t,e){Oi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Xi(t,e,!1)}},Js=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},$s=function(t,e){Xi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Ks=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",Js)),this.setCoverTransitOutCallback(Zs(i,"transitOut",$s)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),o=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,o=!1,n=!1),o&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),o?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.popUp:t=Vs.popUp;break;case Qs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Vs.scaleDown;break;case Qs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?qs(t,e.x,e.y,i,s):!!(r=rr(e,n,!0))&&qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,a=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,o=n.pointersTotal,h=n.pointers,a=0;a0)return Er.length=0,!0;return Er.length=0,!1},Er=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Pr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Pr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class kr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Br={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,o=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Qr extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class fn extends Vr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,un);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ue(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case Tn:this.tracerState=On,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,We);var Pn={};const On=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Bn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Bn(t,e,i,s),t.rotation+=s,t},Rn={};const Mn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,o=r.y,h=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(An(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Ln(An(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Xn="IDLE",Yn="BEGIN",Fn="RECOGNIZED",jn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},Dr.call(t,e),Nr.call(t,e),Fr.call(t,e),Hr.call(t,e),Wn.call(t,e),Hn.call(t,e),Vn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),_t(t)},getChildPrevState:function(t){var e=_t(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=zt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,o,h=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var a=ne(e,"name",!1);a&&(r=ne(a,"createTextCallback",he),n=ne(a,"createTextCallbackScope",void 0),"string"==typeof(o=ne(a,"align","left-top"))&&(o=Lt[o]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.length;p=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return lo(this.sizerChildren,null),ao.call(this,t),this}},co={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)lo(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},fo={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},mo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,lo(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)lo(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},bo=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Co=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue;class Eo extends Kn{constructor(t,e,i,s,r,n,o,h,a,l){Co(e)?(e=So(l=e,"x",0),i=So(l,"y",0),s=So(l,"width",void 0),r=So(l,"height",void 0),n=So(l,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(s)?(s=So(l=s,"width",void 0),r=So(l,"height",void 0),n=So(l,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(n)?(n=So(l=n,"column",l.col||0),o=So(l,"row",0),h=So(l,"columnProportions",0),a=So(l,"rowProportions",0)):Co(h)&&(h=So(l=h,"columnProportions",0),a=So(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(So(l,"createCellContainerCallback")),this.setIndentLeft(So(l,"space.indentLeftOdd",0),So(l,"space.indentLeftEven",0)),this.setIndentTop(So(l,"space.indentTopOdd",0),So(l,"space.indentTopEven",0)),this.resetGrid(n,o,h,a,So(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=yo.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=bo.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Eo.prototype,mo);const xo=Phaser.Math.Wrap;var wo=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,o=0,h=n.length;o(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=o)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=o+1),r};const _o=Phaser.Utils.Objects.IsPlainObject,ko=Phaser.Utils.Objects.GetValue,Bo=Phaser.Display.Align.CENTER,zo={min:0,full:-1};var Ro=function(t,e,i,s,r,n,o,h,a,l,d,u){ce.call(this,t);var c=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=zo[e];else if(_o(e)){var v;e=ko(v=e,"proportion",void 0),i=ko(v,"align",Bo),s=ko(v,"padding",0),r=ko(v,"expand",!1),n=ko(v,"key",void 0),o=ko(v,"index",void 0),t.isRexSizer||(h=ko(v,"minWidth",void 0),a=ko(v,"minHeight",void 0)),l=ko(v,"fitRatio",0),d=ko(v,"offsetX",0),u=ko(v,"offsetY",0)}return"string"==typeof i&&(i=Lt[i]),void 0===e&&(e=c?1:0),void 0===i&&(i=Bo),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===a&&(c?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=de(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=u,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},Mo={add:Ro,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Ro.call(this,new Oo(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,o,h){return _o(i)&&(i.index=t),Ro.call(this,e,i,s,r,n,o,t,h),this},insertAtPosition(t,e,i,s,r,n,o,h,a){var l=To.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,o,h,a),this}};const Lo=Phaser.Utils.Array.Remove;var Do={remove(t,e){return this.getParentSizer(t)!==this||(Lo(this.sizerChildren,t),be.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ao.call(this,t),this}},Ao={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Lt[e]),this.getSizerConfig(t).align=e,this}},Io={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},No={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Xo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,o=0,h=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,o+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,o+=n)))}return a?void 0:o+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,o=s.padding;i=n-(o.left+o.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,o=s.padding;i=n-(o.top+o.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,o,h,a,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=u,f=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Re.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Be.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&wo.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Me.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&wo.call(this,void 0,t),Le.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],o=n&&n.isRexSpace;return"center"===t?o||this.insertSpace(r+1):o&&this.remove(n,!0),this}};Object.assign(Xo,Mo,Do,Ao,Io,No,fo);var Yo=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const jo=Phaser.Utils.Objects.IsPlainObject,Wo=Phaser.Utils.Objects.GetValue;class Go extends Kn{constructor(t,e,i,s,r,n,o){jo(e)?(e=Wo(o=e,"x",0),i=Wo(o,"y",0),s=Wo(o,"width",void 0),r=Wo(o,"height",void 0),n=Wo(o,"orientation",0)):jo(s)?(s=Wo(o=s,"width",void 0),r=Wo(o,"height",void 0),n=Wo(o,"orientation",0)):jo(n)&&(n=Wo(o=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Wo(o,"space.item",0)),this.setStartChildIndex(Wo(o,"startChildIndex",0)),this.setRTL(Wo(o,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Fo[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Yo.call(this)),this._childrenProportion}}Object.assign(Go.prototype,Xo);const Ho=Go.prototype.add,Uo=Go.prototype.addSpace;var Vo=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&Uo.call(this),Ho.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Uo.call(this),this.hasTailSpace=s}else Ho.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Ho.call(this,t,{index:r,proportion:i,expand:!0})}else Ho.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Jo={addButton(t){if(hr(t))for(var e=t,i=0,s=e.length;i=0;i--)Zo.call(this,e[i],t);return this}},Qo=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},th=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Qo.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eh={add(t){return this.buttons.push(t),t._click||(t._click=new mr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),th.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextextarea.min.js b/dist/rextextarea.min.js index dca097f313..36138fa935 100644 --- a/dist/rextextarea.min.js +++ b/dist/rextextarea.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},A=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Me={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Math.Linear;let Pi=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=wi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=wi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Bi),Ni.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ys={};Object.assign(Ys,Ms,Ds,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ys);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class As extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Is=Phaser.GameObjects.Rectangle;class Ws extends Is{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Vs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var wr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=Pn,this.onDrag1End();break;case En:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(_n.prototype,He);var wn={};const Pn=0,On=1,En=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(jn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Ln(jn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const An="IDLE",In="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Ir.call(t,e),Br.call(t,e),Vn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=jt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Tt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class _h extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,yh);var wh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Ph=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Oh=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ih={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Vh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Vh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Wh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Nh.prototype,Ih);const Hh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var ta={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,a,o),e.isStroked&&Jh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ia.prototype,ta);const sa=Phaser.Utils.Objects.GetValue;let ra=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=sa(t,"x",0),i=sa(t,"y",0));var s=this.cornerRadius;s.tl=na(sa(t,"tl",void 0),e,i),s.tr=na(sa(t,"tr",void 0),e,i),s.bl=na(sa(t,"bl",void 0),e,i),s.br=na(sa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ha(this.cornerRadius.br,t)}};var na=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),aa(t),t},ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=sa(e,"x",0),t.y=sa(e,"y",0)),aa(t)},aa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},oa=function(t){return t.x>0&&t.y>0},la=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const da=Phaser.Math.DegToRad;var ca=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const po=Phaser.Utils.Objects.GetValue,vo=Phaser.Utils.Objects.IsPlainObject;class go extends(Aa(Ma)){constructor(t,e,i,s,r,n,h,a){vo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):vo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):vo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new co).setName("trackFill")).addShape((new co).setName("bar")).addShape((new co).setName("trackStroke")),this.setTrackColor(po(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(po(a,"trackStrokeThickness",2),po(a,"trackStrokeColor",void 0)),this.setSkewX(po(a,"skewX",0)),this.setRTL(po(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var fo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&uo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),uo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&uo(a,0,0,e,i,t)}};Object.assign(go.prototype,fo);var mo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(mo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(mo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nzo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=zo(t[i]));return e}const Xo=Phaser.Utils.Objects.IsPlainObject,Ao=Phaser.Utils.Objects.GetValue;var Io=function(t){return"string"==typeof t&&(t=Wo[t]),t};const Wo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Vo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=jo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=zo(i),s=zo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var _=i.length;o<_;o++){if(void 0===i[o]&&(i[o]=d),"number"==typeof i[o]&&(i[o]={width:i[o],stretch:o%2}),f=(v=i[o]).width,0===x&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:f),f>=1&&g>=1){var w=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Xo(t)?(this.stretchMode.edge=Io(Ao(t,"edge",0)),this.stretchMode.internal=Io(Ao(t,"internal",0))):(t=Io(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var Go=void 0,Uo=function(t,e){if(Go||(Go={},Ke(t).events.once("destroy",(function(){for(var t in Go)Go[t].destroy();Go=void 0}))),!Go.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),Go[e]=t}return Go[e]};const $o=Phaser.GameObjects.RenderTexture;class Jo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Vo),i}($o,"rexNinePatch")){}var qo={_drawImage:function(t,e,i,s,r,n){var h=Uo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Uo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Jo.prototype,qo);class Ko extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(xo(t,e))return t[e];var i=t.parent;return xo(i,e)?i[e]:void 0}set(t,e,i){return xo(t,e)?t[e]=i:xo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Zo=Phaser.Utils.Objects.GetValue;class Qo extends Jo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Zo(e,"effects",!0);i&&Oo(this,i),this.style=new Ko(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Qo.prototype,Sa);const tl=["alpha","tint","flipX","flipY"];var el=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new bo(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Qo(t,e):new Mo(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=tl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Rl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Rl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Rl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Rl(t,"enable",!0)),this.holdThreshold=Rl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Rl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jl=Phaser.Utils.Objects.GetValue;class zl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jl(t,"value",0)),this.setSpeed(jl(t,"speed",0)),this.setAcceleration(jl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Xl{constructor(){this.value,this.dir,this.movement=new zl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vl(e,"speed",.1)),this.setEnable(Vl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Nl=Phaser.Utils.Objects.GetValue;var Hl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Nl(s,l,void 0):Nl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ml(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Nl(r,"position",0);"string"==typeof p&&(p=Gl[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Nl(s,"scrollDetectionMode");"string"==typeof b&&(b=Ul[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Wl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,_,w,P,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",w=`scroll${i}`):(S="t",w="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(w,t)}))),y&&(a?(_=`childO${i}`,w=`scroll${i}`):(_="childOY",w="scroll"),y.on("valuechange",(function(e){t[_]=e,t.emit(w,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const Gl={right:0,left:1,bottom:0,top:1},Ul={gameObject:0,rectBounds:1},$l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=$l(e,"width"),h=$l(e,"height");n||$l(e,"child.expandWidth",!0)||(s[1]=0),h||$l(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(t,a,"x",e)}return a},ql=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Kl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Zl=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(ud.call(this,-this.textOY)),0),e=pd.call(this,t)+this.textOY,i=vd.call(this,t);return function(t,e){switch(hd(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,gd.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ae.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,md.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,gd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Utils.Objects.GetValue,xd=Phaser.Display.Align.TOP_LEFT;class Sd extends Kn{constructor(t,e,i,s,r,n){bd(e)?(e=Cd(n=e,"x",0),i=Cd(n,"y",0),s=Cd(n,"width",void 0),r=Cd(n,"height",void 0)):bd(s)&&(s=Cd(n=s,"width",void 0),r=Cd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Cd(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cd(n,"clampTextOY",!0)),this.alwaysScrollable=Cd(n,"alwaysScrollable",!1);var h=Cd(n,"background",void 0),a=Cd(n,"text",void 0);void 0===a&&(a=_d(t)),this.textCropEnable=Cd(n,"textCrop",!!a.setCrop);var o=Cd(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=xd,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=hd(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=cd.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ud.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pd.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var _d=function(t){return t.add.text(0,0,"")};Object.assign(Sd.prototype,yd);var wd={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Pd={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Od=Phaser.Utils.Objects.GetValue;class Ed extends id{constructor(t,e){void 0===e&&(e={});var i=Od(e,"text",void 0),s=Od(e,"textWidth",void 0),r=Od(e,"textHeight",void 0),n=Od(e,"textCrop",!!i.setCrop),h=Od(e,"textMask",!n),a=Od(e,"content",""),o=new Sd(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Od(e,"clampChildOY",!1),alwaysScrollable:Od(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Od(e,"space",void 0);l&&(l.child=Od(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}return Object.assign(Ed.prototype,wd,Pd),Ed},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextarea=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},A=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Me={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ye=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Math.Linear;let Pi=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=wi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=wi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ii(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Bi),Ni.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),ki(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ys={};Object.assign(Ys,Ms,Ds,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ys);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class As extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Is=Phaser.GameObjects.Rectangle;class Ws extends Is{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fs=Phaser.Utils.Objects.GetValue;class Vs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var wr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends Ts{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Er(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=En,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=Pn,this.onDrag1End();break;case En:this.tracerState=On,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case On:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==En)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(_n.prototype,He);var wn={};const Pn=0,On=1,En=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(jn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Ln(jn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const An="IDLE",In="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Ir.call(t,e),Br.call(t,e),Vn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=jt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Tt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class _h extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(n)&&(n=Sh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,yh);var wh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Ph=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Oh=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ih={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Vh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Vh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Wh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Nh.prototype,Ih);const Hh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var ta={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,a,o),e.isStroked&&Jh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ia.prototype,ta);const sa=Phaser.Utils.Objects.GetValue;let ra=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=sa(t,"x",0),i=sa(t,"y",0));var s=this.cornerRadius;s.tl=na(sa(t,"tl",void 0),e,i),s.tr=na(sa(t,"tr",void 0),e,i),s.bl=na(sa(t,"bl",void 0),e,i),s.br=na(sa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ha(this.cornerRadius.br,t)}};var na=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),aa(t),t},ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=sa(e,"x",0),t.y=sa(e,"y",0)),aa(t)},aa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},oa=function(t){return t.x>0&&t.y>0},la=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const da=Phaser.Math.DegToRad;var ca=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const po=Phaser.Utils.Objects.GetValue,vo=Phaser.Utils.Objects.IsPlainObject;class go extends(Aa(Ma)){constructor(t,e,i,s,r,n,h,a){vo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):vo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):vo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new co).setName("trackFill")).addShape((new co).setName("bar")).addShape((new co).setName("trackStroke")),this.setTrackColor(po(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(po(a,"trackStrokeThickness",2),po(a,"trackStrokeColor",void 0)),this.setSkewX(po(a,"skewX",0)),this.setRTL(po(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var fo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&uo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),uo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&uo(a,0,0,e,i,t)}};Object.assign(go.prototype,fo);var mo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(mo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(mo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nzo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=zo(t[i]));return e}const Xo=Phaser.Utils.Objects.IsPlainObject,Ao=Phaser.Utils.Objects.GetValue;var Io=function(t){return"string"==typeof t&&(t=Wo[t]),t};const Wo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Vo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=jo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=zo(i),s=zo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var _=i.length;o<_;o++){if(void 0===i[o]&&(i[o]=d),"number"==typeof i[o]&&(i[o]={width:i[o],stretch:o%2}),f=(v=i[o]).width,0===x&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:f),f>=1&&g>=1){var w=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Xo(t)?(this.stretchMode.edge=Io(Ao(t,"edge",0)),this.stretchMode.internal=Io(Ao(t,"internal",0))):(t=Io(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var Go=void 0,Uo=function(t,e){if(Go||(Go={},Ke(t).events.once("destroy",(function(){for(var t in Go)Go[t].destroy();Go=void 0}))),!Go.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),Go[e]=t}return Go[e]};const $o=Phaser.GameObjects.RenderTexture;class Jo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Vo),i}($o,"rexNinePatch")){}var qo={_drawImage:function(t,e,i,s,r,n){var h=Uo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Uo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Jo.prototype,qo);class Ko extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(xo(t,e))return t[e];var i=t.parent;return xo(i,e)?i[e]:void 0}set(t,e,i){return xo(t,e)?t[e]=i:xo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Zo=Phaser.Utils.Objects.GetValue;class Qo extends Jo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Zo(e,"effects",!0);i&&Oo(this,i),this.style=new Ko(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Qo.prototype,Sa);const tl=["alpha","tint","flipX","flipY"];var el=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new bo(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Qo(t,e):new Mo(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=tl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Rl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Rl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Rl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Rl(t,"enable",!0)),this.holdThreshold=Rl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Rl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jl=Phaser.Utils.Objects.GetValue;class zl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jl(t,"value",0)),this.setSpeed(jl(t,"speed",0)),this.setAcceleration(jl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Xl{constructor(){this.value,this.dir,this.movement=new zl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vl(e,"speed",.1)),this.setEnable(Vl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Nl=Phaser.Utils.Objects.GetValue;var Hl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Nl(s,l,void 0):Nl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ml(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Nl(r,"position",0);"string"==typeof p&&(p=Gl[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Nl(s,"scrollDetectionMode");"string"==typeof b&&(b=Ul[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Wl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,_,w,P,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",w=`scroll${i}`):(S="t",w="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(w,t)}))),y&&(a?(_=`childO${i}`,w=`scroll${i}`):(_="childOY",w="scroll"),y.on("valuechange",(function(e){t[_]=e,t.emit(w,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const Gl={right:0,left:1,bottom:0,top:1},Ul={gameObject:0,rectBounds:1},$l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=$l(e,"width"),h=$l(e,"height");n||$l(e,"child.expandWidth",!0)||(s[1]=0),h||$l(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(t,a,"x",e)}return a},ql=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Kl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Zl=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(ud.call(this,-this.textOY)),0),e=pd.call(this,t)+this.textOY,i=vd.call(this,t);return function(t,e){switch(hd(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,gd.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ae.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,md.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,gd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Utils.Objects.GetValue,xd=Phaser.Display.Align.TOP_LEFT;class Sd extends Kn{constructor(t,e,i,s,r,n){bd(e)?(e=Cd(n=e,"x",0),i=Cd(n,"y",0),s=Cd(n,"width",void 0),r=Cd(n,"height",void 0)):bd(s)&&(s=Cd(n=s,"width",void 0),r=Cd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Cd(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cd(n,"clampTextOY",!0)),this.alwaysScrollable=Cd(n,"alwaysScrollable",!1);var h=Cd(n,"background",void 0),a=Cd(n,"text",void 0);void 0===a&&(a=_d(t)),this.textCropEnable=Cd(n,"textCrop",!!a.setCrop);var o=Cd(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=xd,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=hd(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=cd.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ud.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pd.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var _d=function(t){return t.add.text(0,0,"")};Object.assign(Sd.prototype,yd);var wd={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Pd={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Od=Phaser.Utils.Objects.GetValue;class Ed extends id{constructor(t,e){void 0===e&&(e={});var i=Od(e,"text",void 0),s=Od(e,"textWidth",void 0),r=Od(e,"textHeight",void 0),n=Od(e,"textCrop",!!i.setCrop),h=Od(e,"textMask",!n),a=Od(e,"content",""),o=new Sd(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Od(e,"clampChildOY",!1),alwaysScrollable:Od(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Od(e,"space",void 0);l&&(l.child=Od(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}return Object.assign(Ed.prototype,wd,Pd),Ed},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextarea=e(); diff --git a/dist/rextextareainput.js b/dist/rextextareainput.js index c96593d58c..edb42f1000 100644 --- a/dist/rextextareainput.js +++ b/dist/rextextareainput.js @@ -12192,7 +12192,7 @@ var LayoutChildren$1 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$C(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$C(config, 'offsetX', 0); + offsetY = GetValue$C(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextextareainput.min.js b/dist/rextextareainput.min.js index 83ae0cfd74..72533321e2 100644 --- a/dist/rextextareainput.min.js +++ b/dist/rextextareainput.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends oi{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,o):r.resetFromJSON(o),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var o,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class zi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Vi),Hi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=qi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=qi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=qi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=qi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const as=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ms,Ds,Rs,Ls);const Ys=Phaser.Utils.Objects.GetValue;class As extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Xs);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Is=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Fs=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ke(t).loop.delta};const an=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ne);var Pn={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(Yn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Ln(Yn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",jn="BEGIN",In="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),Ar.call(t,e),jr.call(t,e),Vr.call(t,e),Bn.call(t,e),Hn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var a=oe(e,"name",!1);a&&(r=oe(a,"createTextCallback",le),n=oe(a,"createTextCallbackScope",void 0),"string"==typeof(h=oe(a,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,o,a,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(o=nh(u,"minWidth",void 0),a=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return rh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Ph={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},_h=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},Yh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},jh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Bh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Hh extends Kn{constructor(t,e,i,s,r,n,h,o,a,l){Bh(e)?(e=Vh(l=e,"x",0),i=Vh(l,"y",0),s=Vh(l,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(s)?(s=Vh(l=s,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(n)?(n=Vh(l=n,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(o)&&(o=Vh(l=o,"columnProportions",0),a=Vh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Vh(l,"createCellContainerCallback")),this.setIndentLeft(Vh(l,"space.indentLeftOdd",0),Vh(l,"space.indentLeftEven",0)),this.setIndentTop(Vh(l,"space.indentTopOdd",0),Vh(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Vh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Ih.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Hh.prototype,jh);const Nh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,a=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,a=255&r;t.fillStyle="rgba("+h+","+o+","+a+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,a=255&r;t.strokeStyle="rgba("+h+","+o+","+a+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var to={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,a=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,o,a),e.isStroked&&Jh(r,e,l,o,a),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,o=e.pathData,a=o.length-1,l=o[0]-n,d=o[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(a-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(io.prototype,to);const so=Phaser.Utils.Objects.GetValue;let ro=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=so(t,"x",0),i=so(t,"y",0));var s=this.cornerRadius;s.tl=no(so(t,"tl",void 0),e,i),s.tr=no(so(t,"tr",void 0),e,i),s.bl=no(so(t,"bl",void 0),e,i),s.br=no(so(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ho(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ho(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ho(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ho(this.cornerRadius.br,t)}};var no=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oo(t),t},ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=so(e,"x",0),t.y=so(e,"y",0)),oo(t)},oo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ao=function(t){return t.x>0&&t.y>0},lo=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const co=Phaser.Math.DegToRad;var uo=function(t,e,i,s,r,n,h,o,a){h&&n>r?n-=360:!h&&n0,h=0,o=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const ga=Phaser.Utils.Objects.GetValue,fa=Phaser.Utils.Objects.IsPlainObject;class ma extends(Fo(Lo)){constructor(t,e,i,s,r,n,h,o){fa(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,h=o.value):fa(s)?(s=(o=s).width,r=o.height,n=o.barColor,h=o.value):fa(n)&&(n=(o=n).barColor,h=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new pa).setName("trackFill")).addShape((new pa).setName("bar")).addShape((new pa).setName("trackStroke")),this.setTrackColor(ga(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ga(o,"trackStrokeThickness",2),ga(o,"trackStrokeColor",void 0)),this.setSkewX(ga(o,"skewX",0)),this.setRTL(ga(o,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ya={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&va(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),va(h,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&va(o,0,0,e,i,t)}};Object.assign(ma.prototype,ya);var ba=function(t){return null==t||""===t||0===t.length},Ca=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ba(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ba(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWa(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Wa(t[i]));return e}const ja=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue;var Fa=function(t){return"string"==typeof t&&(t=Ba[t]),t};const Ba={scale:0,repeat:1};var Va=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ha={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=za),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Wa(i),s=Wa(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,o=0,a=0,l=i.length;a0?h/o:0,c=n.height,u=0;for(a=0,l=s.length;a0?0:g,b=0,a=0;for(var S=i.length;a0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(a,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,o,a=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-a,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/a,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*a;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,o):this._drawTileSprite(this.textureKey,s,m,y,h,o)),m+=h;y+=o}this._endDraw()},setStretchMode:function(t){return ja(t)?(this.stretchMode.edge=Fa(Ia(t,"edge",0)),this.stretchMode.internal=Fa(Ia(t,"internal",0))):(t=Fa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Va.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Ua=Phaser.GameObjects;var $a=void 0,Ja=function(t,e){if($a||($a={},Ke(t).events.once("destroy",(function(){for(var t in $a)$a[t].destroy();$a=void 0}))),!$a.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ua[e](i)).setOrigin(0),$a[e]=t}return $a[e]};const qa=Phaser.GameObjects.RenderTexture;class Ka extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,o,a,l,d){if(Na(i)?(i=Ga(d=i,"x",0),s=Ga(d,"y",0),r=Ga(d,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(r)?(r=Ga(d=r,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(h)?(h=Ga(d=h,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(o)?(o=Ga(d=o,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Array.isArray(o)?(d=l,l=a,a=o,o=Ga(d,"baseFrame",void 0)):Na(a)&&(a=Ga(d=a,"columns",void 0),l=Ga(d,"rows",void 0)),void 0===o&&(o=Ga(d,"frame",void 0)),void 0===a){var c=Ga(d,"leftWidth",void 0),u=Ga(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(a=[c,void 0,u])}if(void 0===l){var p=Ga(d,"topHeight",void 0),v=Ga(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ga(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ga(d,"stretchMode",0)),this.setPreserveRatio(Ga(d,"preserveRatio",!0));var g=Ga(d,"maxFixedPartScale",1),f=Ga(d,"maxFixedPartScaleX",g),m=Ga(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,o,a,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ha),i}(qa,"rexNinePatch")){}var Za={_drawImage:function(t,e,i,s,r,n){var h=Ja(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ja(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ka.prototype,Za);class Qa extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sa(t,e))return t[e];var i=t.parent;return Sa(i,e)?i[e]:void 0}set(t,e,i){return Sa(t,e)?t[e]=i:Sa(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const tl=Phaser.Utils.Objects.GetValue;class el extends Ka{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ka(this,i),this.style=new Qa(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,Oo);const il=["alpha","tint","flipX","flipY"];var sl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new xa(t,e);break;case"image":s=new Aa(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ra(t,e);break;default:s=new _o(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=il.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class Al extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const zl=Phaser.Utils.Objects.GetValue;class Wl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(zl(t,"value",0)),this.setSpeed(zl(t,"speed",0)),this.setAcceleration(zl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class jl{constructor(){this.value,this.dir,this.movement=new Wl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Vl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Nl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Gl=Phaser.Utils.Objects.GetValue;var Ul=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,a=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Gl(s,l,void 0):Gl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Gl(r,"position",0);"string"==typeof p&&(p=$l[p]);var v,g,f=Gl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gl(s,"space.slider",void 0))&&(o?f=0:v=Gl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Gl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Gl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Gl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Gl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Gl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gl(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[b]);var C=`scroller${i}`;(m=o||s.hasOwnProperty(C)?Gl(s,C,!0):Gl(s,"scroller",!0))&&a&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Bl(a,m),a.isRexContainerLite&&a.sendChildToBack(a));var x,w,S,P,O,_=Gl(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&a&&(void 0!==b&&(_.focus=1===b?2:0),x=new Nl(a,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),o&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(o?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(o?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=o?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const $l={right:0,left:1,bottom:0,top:1},Jl={gameObject:0,rectBounds:1},ql=Phaser.Utils.Objects.GetValue;var Kl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ql(e,"width"),h=ql(e,"height");n||ql(e,"child.expandWidth",!0)||(s[1]=0),h||ql(e,"child.expandHeight",!0)||(r[1]=0);var o=new Hh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nh(i,"child"),r=Nh(s,"gameObject",void 0);if(r){var n=Nh(i,"space.child",0);t.childMargin={};var h=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),o.left=Nh(n,"left",0),o.right=Nh(n,"right",0);break;case 1:h.top=Nh(n,"left",0),h.bottom=Nh(n,"right",0),o.top=Nh(n,"top",0),o.bottom=Nh(n,"bottom",0);break;default:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),h.left=Nh(n,"left",0),h.right=Nh(n,"right",0)}e.add(r,{column:1,row:1,align:Nh(s,"align","center"),padding:o,expand:{width:Nh(s,"expandWidth",!0),height:Nh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ul(t,o,"y",e);break;case 1:Ul(t,o,"x",e);break;default:Ul(t,o,"y",e),Ul(t,o,"x",e)}return o},Zl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ad.prototype,Rd);const zd=Phaser.Utils.String.Pad;var Wd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},jd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Id=Phaser.Math.DegToRad;var Fd=function(t){return!t.hasOwnProperty("convex")||t.convex},Bd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,l,a,l,180,270,!1,h):Vd(t,0,0,a,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,l,a,l,270,360,!1,h):Vd(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=m.br,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,r-l,a,l,0,90,!1,h):Vd(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=m.bl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,r-l,a,l,90,180,!1,h):Vd(t,0,r,a,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const Nd=Phaser.Utils.Objects.GetValue;class Gd extends Ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nd(e,"color",null),Nd(e,"color2",null),Nd(e,"horizontalGradient",!0)),this.setStroke(Nd(e,"stroke",null),Nd(e,"strokeThickness",2)),this.setCornerRadius(Nd(e,"cornerRadius",0),Nd(e,"cornerIteration",null))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,jd("color2",t,this),jd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,jd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,jd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),Hd(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ud=Phaser.Utils.Objects.GetValue;class $d extends Ad{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ud(e,"color",null),Ud(e,"color2",null),Ud(e,"horizontalGradient",!0)),this.setStroke(Ud(e,"stroke",null),Ud(e,"strokeThickness",2))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ud(t,"color2",null),Ud(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ud(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Jd=Phaser.Utils.Objects.GetValue;class qd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Jd(t,"bold",!1)),this.setItalic(Jd(t,"italic",!1)),this.setFontSize(Jd(t,"fontSize","16px")),this.setFontFamily(Jd(t,"fontFamily","Courier")),this.setColor(Jd(t,"color","#fff")),this.setStrokeStyle(Jd(t,"stroke",null),Jd(t,"strokeThickness",0)),this.setShadow(Jd(t,"shadowColor",null),Jd(t,"shadowOffsetX",0),Jd(t,"shadowOffsetY",0),Jd(t,"shadowBlur",0)),this.setOffset(Jd(t,"offsetX",0),Jd(t,"offsetY",0)),this.setSpace(Jd(t,"leftSpace",0),Jd(t,"rightSpace",0)),this.setAlign(Jd(t,"align",void 0)),this.setBackgroundColor(Jd(t,"backgroundColor",null)),this.setBackgroundHeight(Jd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Jd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(jd("stroke",t,this),jd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(jd("shadowOffsetX",t,this),jd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new qd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Wd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Wd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Wd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Wd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Kd=Phaser.Utils.Array.Remove,Zd=Phaser.Utils.Array.Remove,Qd="text",tc="image",ec="drawer",ic="space",sc="command";var rc=function(t){return t.type===Qd&&"\n"===t.text},nc=function(t){return t.type===Qd&&"\f"===t.text},hc=function(t){return t.type===Qd};class oc extends Ad{constructor(t,e,i){super(t,Qd),this.updateTextFlag=!1,this.style=new qd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var o=e.hasFill,a=e.hasStroke;(o||a)&&(e.syncFont(t).syncStyle(t),a&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ac=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const lc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class dc extends Ad{constructor(t,e,i){super(t,tc),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=lc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),a.drawImage(l,0,0,r,n,i,s,r,n),lc.remove(l)}else a.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class cc extends Ad{constructor(t,e,i,s){super(t,ec),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class uc extends Ad{constructor(t,e){super(t,ic),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class pc extends fd{constructor(t,e,i,s,r){super(t,sc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var vc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const gc={none:0,word:1,char:2,character:2,mix:3};var fc=/^[\x00-\x7F]+$/,mc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,o=!n&&!h,a=t.length,l=e,d=s.word,c=0,u=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=xc.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=xc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Sc(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=Sc(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Sc(t,"wrapMode");void 0===c&&(c=Sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=gc[c]);var u=Sc(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Sc(t,"letterSpacing",0),v=Sc(t,"hAlign",0),g=Sc(t,"vAlign",0),f=Sc(t,"justifyPercentage",.25),m=vc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_c(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_c(t,"maxLines",0);var o=0===i,a=_c(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=_c(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var c=_c(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_c(t,"letterSpacing",0),p=_c(t,"rtl",!0),v=_c(t,"hAlign",p?2:0),g=_c(t,"vAlign",0),f=vc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:a,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=a.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Kd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Zd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Qd);return null===i?i=new oc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Dd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Kc=Phaser.Utils.Objects.GetFastValue;var Zc={};class Qc{constructor(t){this.pools=Kc(t,"pools",Zc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&a=i&&ai.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=a<0?0-a:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wu(this),Su(this)),this}setNumberInput(){return this.onUpdateCallback=xu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const _u=Phaser.Utils.Objects.GetValue,Tu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ku=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(o,o+h.count));o+=h.count,h.added||(a+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Yu.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,a=1,l=h+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*a;s<=a;s+=2){let a,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=o)return n(Au(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();u()||t()}),0)}();else for(;a<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const zu=new Yu,Wu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,ju=/\S/,Iu=new Yu;Iu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ju.test(t)&&!ju.test(e)},Iu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Hu(t,null,null,i),i," ")},Vu.equals=function(t,e){return Yu.prototype.equals.call(Vu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nu=new Yu;Nu.tokenize=function(t){return t.slice()},Nu.join=Nu.removeEmpty=function(t){return t};const Gu=Phaser.Utils.Array.Remove;var Uu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Gu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,zu.diff(a,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Zu={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qu=Phaser.Utils.Objects.IsPlainObject;class tp extends iu{constructor(t,e,i,s,r,n){Qu(e)?n=e:Qu(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ku(e,"wrap.vAlign")||Ca(e,"wrap.vAlign",s=i?"center":"top"),ku(e,"wrap.wrapMode")||Ca(e,"wrap.wrapMode","char"),ku(e,"wrap.maxLines")||Ca(e,"wrap.maxLines",s=i?1:void 0),i&&Ca(e,"wrap.wrapWidth",1/0),ku(e,"wrap.useDefaultTextHeight")||Ca(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ku(e.edit,"inputType")){var s=i?"text":"textarea";Ca(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Mu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=yo(n.background,"focus"),a=yo(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=_u(e,"edit");return void 0===i&&(i={}),nu(e,i,Tu),new Ou(t,i)}(this,n),Du.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Xu.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),Lu.call(this,a);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Oe=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};const _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Le=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends oi{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,o):r.resetFromJSON(o),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var o,a;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class zi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Vi),Hi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=qi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=qi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=qi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=qi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const as=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ls={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ms,Ds,Rs,Ls);const Ys=Phaser.Utils.Objects.GetValue;class As extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(As.prototype,Xs);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Is=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Fs=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=qs(e,"destroy",!0),super(t,e);var i=qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));var s=qs(e,"touchOutsideClose",!1),r=qs(e,"duration.hold",-1),n=qs(e,"timeOutClose",r>=0),h=qs(e,"anyTouchClose",!1);qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Or extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Tr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ke(t).loop.delta};const an=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=_n,this.onDrag1Start();break;case _n:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ne);var Pn={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(Yn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Ln(Yn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",jn="BEGIN",In="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),Ar.call(t,e),jr.call(t,e),Vr.call(t,e),Bn.call(t,e),Hn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var a=oe(e,"name",!1);a&&(r=oe(a,"createTextCallback",le),n=oe(a,"createTextCallbackScope",void 0),"string"==typeof(h=oe(a,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,o,a,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=oh[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(o=nh(v,"minWidth",void 0),a=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return rh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ae.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(n)&&(n=wh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Ph={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},_h=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Lh(this.sizerChildren,null),ch.call(this,t),this}},Yh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},jh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Bh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Hh extends Kn{constructor(t,e,i,s,r,n,h,o,a,l){Bh(e)?(e=Vh(l=e,"x",0),i=Vh(l,"y",0),s=Vh(l,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(s)?(s=Vh(l=s,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(n)?(n=Vh(l=n,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(o)&&(o=Vh(l=o,"columnProportions",0),a=Vh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Vh(l,"createCellContainerCallback")),this.setIndentLeft(Vh(l,"space.indentLeftOdd",0),Vh(l,"space.indentLeftEven",0)),this.setIndentTop(Vh(l,"space.indentTopOdd",0),Vh(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Vh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Ih.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Hh.prototype,jh);const Nh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,a=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,a=255&r;t.fillStyle="rgba("+h+","+o+","+a+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,a=255&r;t.strokeStyle="rgba("+h+","+o+","+a+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var to={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,a=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,o,a),e.isStroked&&Jh(r,e,l,o,a),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,o=e.pathData,a=o.length-1,l=o[0]-n,d=o[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(a-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(io.prototype,to);const so=Phaser.Utils.Objects.GetValue;let ro=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=so(t,"x",0),i=so(t,"y",0));var s=this.cornerRadius;s.tl=no(so(t,"tl",void 0),e,i),s.tr=no(so(t,"tr",void 0),e,i),s.bl=no(so(t,"bl",void 0),e,i),s.br=no(so(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ho(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ho(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ho(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ho(this.cornerRadius.br,t)}};var no=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oo(t),t},ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=so(e,"x",0),t.y=so(e,"y",0)),oo(t)},oo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ao=function(t){return t.x>0&&t.y>0},lo=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const co=Phaser.Math.DegToRad;var uo=function(t,e,i,s,r,n,h,o,a){h&&n>r?n-=360:!h&&n0,h=0,o=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const ga=Phaser.Utils.Objects.GetValue,fa=Phaser.Utils.Objects.IsPlainObject;class ma extends(Fo(Lo)){constructor(t,e,i,s,r,n,h,o){fa(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,h=o.value):fa(s)?(s=(o=s).width,r=o.height,n=o.barColor,h=o.value):fa(n)&&(n=(o=n).barColor,h=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new pa).setName("trackFill")).addShape((new pa).setName("bar")).addShape((new pa).setName("trackStroke")),this.setTrackColor(ga(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ga(o,"trackStrokeThickness",2),ga(o,"trackStrokeColor",void 0)),this.setSkewX(ga(o,"skewX",0)),this.setRTL(ga(o,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ya={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&va(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),va(h,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&va(o,0,0,e,i,t)}};Object.assign(ma.prototype,ya);var ba=function(t){return null==t||""===t||0===t.length},Ca=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ba(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ba(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWa(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Wa(t[i]));return e}const ja=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue;var Fa=function(t){return"string"==typeof t&&(t=Ba[t]),t};const Ba={scale:0,repeat:1};var Va=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ha={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=za),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Wa(i),s=Wa(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,o=0,a=0,l=i.length;a0?h/o:0,c=n.height,u=0;for(a=0,l=s.length;a0?0:g,b=0,a=0;for(var S=i.length;a0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(a,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,o,a=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-a,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/a,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*a;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,o):this._drawTileSprite(this.textureKey,s,m,y,h,o)),m+=h;y+=o}this._endDraw()},setStretchMode:function(t){return ja(t)?(this.stretchMode.edge=Fa(Ia(t,"edge",0)),this.stretchMode.internal=Fa(Ia(t,"internal",0))):(t=Fa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Va.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Ua=Phaser.GameObjects;var $a=void 0,Ja=function(t,e){if($a||($a={},Ke(t).events.once("destroy",(function(){for(var t in $a)$a[t].destroy();$a=void 0}))),!$a.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ua[e](i)).setOrigin(0),$a[e]=t}return $a[e]};const qa=Phaser.GameObjects.RenderTexture;class Ka extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,o,a,l,d){if(Na(i)?(i=Ga(d=i,"x",0),s=Ga(d,"y",0),r=Ga(d,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(r)?(r=Ga(d=r,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(h)?(h=Ga(d=h,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(o)?(o=Ga(d=o,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Array.isArray(o)?(d=l,l=a,a=o,o=Ga(d,"baseFrame",void 0)):Na(a)&&(a=Ga(d=a,"columns",void 0),l=Ga(d,"rows",void 0)),void 0===o&&(o=Ga(d,"frame",void 0)),void 0===a){var c=Ga(d,"leftWidth",void 0),u=Ga(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(a=[c,void 0,u])}if(void 0===l){var p=Ga(d,"topHeight",void 0),v=Ga(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ga(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ga(d,"stretchMode",0)),this.setPreserveRatio(Ga(d,"preserveRatio",!0));var g=Ga(d,"maxFixedPartScale",1),f=Ga(d,"maxFixedPartScaleX",g),m=Ga(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,o,a,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ha),i}(qa,"rexNinePatch")){}var Za={_drawImage:function(t,e,i,s,r,n){var h=Ja(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ja(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ka.prototype,Za);class Qa extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sa(t,e))return t[e];var i=t.parent;return Sa(i,e)?i[e]:void 0}set(t,e,i){return Sa(t,e)?t[e]=i:Sa(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const tl=Phaser.Utils.Objects.GetValue;class el extends Ka{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ka(this,i),this.style=new Qa(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,Oo);const il=["alpha","tint","flipX","flipY"];var sl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new xa(t,e);break;case"image":s=new Aa(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ra(t,e);break;default:s=new _o(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=il.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class Al extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!nr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!nr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const zl=Phaser.Utils.Objects.GetValue;class Wl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(zl(t,"value",0)),this.setSpeed(zl(t,"speed",0)),this.setAcceleration(zl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class jl{constructor(){this.value,this.dir,this.movement=new Wl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Vl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Nl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||nr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Gl=Phaser.Utils.Objects.GetValue;var Ul=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,a=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Gl(s,l,void 0):Gl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=Gl(r,"position",0);"string"==typeof p&&(p=$l[p]);var v,g,f=Gl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gl(s,"space.slider",void 0))&&(o?f=0:v=Gl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Gl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Gl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Gl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Gl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Gl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gl(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[b]);var C=`scroller${i}`;(m=o||s.hasOwnProperty(C)?Gl(s,C,!0):Gl(s,"scroller",!0))&&a&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Bl(a,m),a.isRexContainerLite&&a.sendChildToBack(a));var x,w,S,P,O,_=Gl(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&a&&(void 0!==b&&(_.focus=1===b?2:0),x=new Nl(a,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),o&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(o?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(o?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=o?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const $l={right:0,left:1,bottom:0,top:1},Jl={gameObject:0,rectBounds:1},ql=Phaser.Utils.Objects.GetValue;var Kl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ql(e,"width"),h=ql(e,"height");n||ql(e,"child.expandWidth",!0)||(s[1]=0),h||ql(e,"child.expandHeight",!0)||(r[1]=0);var o=new Hh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nh(i,"child"),r=Nh(s,"gameObject",void 0);if(r){var n=Nh(i,"space.child",0);t.childMargin={};var h=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),o.left=Nh(n,"left",0),o.right=Nh(n,"right",0);break;case 1:h.top=Nh(n,"left",0),h.bottom=Nh(n,"right",0),o.top=Nh(n,"top",0),o.bottom=Nh(n,"bottom",0);break;default:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),h.left=Nh(n,"left",0),h.right=Nh(n,"right",0)}e.add(r,{column:1,row:1,align:Nh(s,"align","center"),padding:o,expand:{width:Nh(s,"expandWidth",!0),height:Nh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ul(t,o,"y",e);break;case 1:Ul(t,o,"x",e);break;default:Ul(t,o,"y",e),Ul(t,o,"x",e)}return o},Zl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ad.prototype,Rd);const zd=Phaser.Utils.String.Pad;var Wd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},jd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Id=Phaser.Math.DegToRad;var Fd=function(t){return!t.hasOwnProperty("convex")||t.convex},Bd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,l,a,l,180,270,!1,h):Vd(t,0,0,a,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,l,a,l,270,360,!1,h):Vd(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=m.br,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,r-l,a,l,0,90,!1,h):Vd(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=m.bl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,r-l,a,l,90,180,!1,h):Vd(t,0,r,a,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const Nd=Phaser.Utils.Objects.GetValue;class Gd extends Ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nd(e,"color",null),Nd(e,"color2",null),Nd(e,"horizontalGradient",!0)),this.setStroke(Nd(e,"stroke",null),Nd(e,"strokeThickness",2)),this.setCornerRadius(Nd(e,"cornerRadius",0),Nd(e,"cornerIteration",null))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,jd("color2",t,this),jd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,jd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,jd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),Hd(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ud=Phaser.Utils.Objects.GetValue;class $d extends Ad{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ud(e,"color",null),Ud(e,"color2",null),Ud(e,"horizontalGradient",!0)),this.setStroke(Ud(e,"stroke",null),Ud(e,"strokeThickness",2))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ud(t,"color2",null),Ud(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ud(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Jd=Phaser.Utils.Objects.GetValue;class qd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Jd(t,"bold",!1)),this.setItalic(Jd(t,"italic",!1)),this.setFontSize(Jd(t,"fontSize","16px")),this.setFontFamily(Jd(t,"fontFamily","Courier")),this.setColor(Jd(t,"color","#fff")),this.setStrokeStyle(Jd(t,"stroke",null),Jd(t,"strokeThickness",0)),this.setShadow(Jd(t,"shadowColor",null),Jd(t,"shadowOffsetX",0),Jd(t,"shadowOffsetY",0),Jd(t,"shadowBlur",0)),this.setOffset(Jd(t,"offsetX",0),Jd(t,"offsetY",0)),this.setSpace(Jd(t,"leftSpace",0),Jd(t,"rightSpace",0)),this.setAlign(Jd(t,"align",void 0)),this.setBackgroundColor(Jd(t,"backgroundColor",null)),this.setBackgroundHeight(Jd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Jd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(jd("stroke",t,this),jd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(jd("shadowOffsetX",t,this),jd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new qd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Wd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Wd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Wd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Wd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Kd=Phaser.Utils.Array.Remove,Zd=Phaser.Utils.Array.Remove,Qd="text",tc="image",ec="drawer",ic="space",sc="command";var rc=function(t){return t.type===Qd&&"\n"===t.text},nc=function(t){return t.type===Qd&&"\f"===t.text},hc=function(t){return t.type===Qd};class oc extends Ad{constructor(t,e,i){super(t,Qd),this.updateTextFlag=!1,this.style=new qd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var o=e.hasFill,a=e.hasStroke;(o||a)&&(e.syncFont(t).syncStyle(t),a&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ac=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const lc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class dc extends Ad{constructor(t,e,i){super(t,tc),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=lc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),a.drawImage(l,0,0,r,n,i,s,r,n),lc.remove(l)}else a.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class cc extends Ad{constructor(t,e,i,s){super(t,ec),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class uc extends Ad{constructor(t,e){super(t,ic),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class pc extends fd{constructor(t,e,i,s,r){super(t,sc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var vc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const gc={none:0,word:1,char:2,character:2,mix:3};var fc=/^[\x00-\x7F]+$/,mc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,o=!n&&!h,a=t.length,l=e,d=s.word,c=0,u=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=xc.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=xc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Sc(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=Sc(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Sc(t,"wrapMode");void 0===c&&(c=Sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=gc[c]);var u=Sc(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Sc(t,"letterSpacing",0),v=Sc(t,"hAlign",0),g=Sc(t,"vAlign",0),f=Sc(t,"justifyPercentage",.25),m=vc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_c(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_c(t,"maxLines",0);var o=0===i,a=_c(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=_c(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var c=_c(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_c(t,"letterSpacing",0),p=_c(t,"rtl",!0),v=_c(t,"hAlign",p?2:0),g=_c(t,"vAlign",0),f=vc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:a,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=a.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Kd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Zd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Qd);return null===i?i=new oc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Dd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Kc=Phaser.Utils.Objects.GetFastValue;var Zc={};class Qc{constructor(t){this.pools=Kc(t,"pools",Zc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&a=i&&ai.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=a<0?0-a:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wu(this),Su(this)),this}setNumberInput(){return this.onUpdateCallback=xu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const _u=Phaser.Utils.Objects.GetValue,Tu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ku=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(o,o+h.count));o+=h.count,h.added||(a+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Yu.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,a=1,l=h+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*a;s<=a;s+=2){let a,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=o)return n(Au(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();u()||t()}),0)}();else for(;a<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const zu=new Yu,Wu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,ju=/\S/,Iu=new Yu;Iu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ju.test(t)&&!ju.test(e)},Iu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Hu(t,null,null,i),i," ")},Vu.equals=function(t,e){return Yu.prototype.equals.call(Vu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nu=new Yu;Nu.tokenize=function(t){return t.slice()},Nu.join=Nu.removeEmpty=function(t){return t};const Gu=Phaser.Utils.Array.Remove;var Uu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Gu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,zu.diff(a,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Zu={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qu=Phaser.Utils.Objects.IsPlainObject;class tp extends iu{constructor(t,e,i,s,r,n){Qu(e)?n=e:Qu(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ku(e,"wrap.vAlign")||Ca(e,"wrap.vAlign",s=i?"center":"top"),ku(e,"wrap.wrapMode")||Ca(e,"wrap.wrapMode","char"),ku(e,"wrap.maxLines")||Ca(e,"wrap.maxLines",s=i?1:void 0),i&&Ca(e,"wrap.wrapWidth",1/0),ku(e,"wrap.useDefaultTextHeight")||Ca(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ku(e.edit,"inputType")){var s=i?"text":"textarea";Ca(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Mu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=yo(n.background,"focus"),a=yo(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=_u(e,"edit");return void 0===i&&(i={}),nu(e,i,Tu),new Ou(t,i)}(this,n),Du.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Xu.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),Lu.call(this,a);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextextbox.min.js b/dist/rextextbox.min.js index ff548efcfe..71ab9bb4e0 100644 --- a/dist/rextextbox.min.js +++ b/dist/rextextbox.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const e=Phaser.Scene;var i=function(t){return t instanceof e},s=function(t){return null==t||"object"!=typeof t?null:i(t)?t:t.scene&&i(t.scene)?t.scene:t.parent&&t.parent.scene&&i(t.parent.scene)?t.parent.scene:null};const r=Phaser.Game;var n=function(t){return t instanceof r},h=function(t){return null==t||"object"!=typeof t?null:n(t)?t:n(t.game)?t.game:i(t)?t.sys.game:i(t.scene)?t.scene.sys.game:void 0};const a=Phaser.Utils.Objects.GetValue;class o{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(a(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=s(t),this.game=h(t),this}}Object.assign(o.prototype,t);const l=Phaser.GameObjects.Text;var d=function(t){return t instanceof l};const c=Phaser.GameObjects.BitmapText;var u=function(t){return t instanceof c},p=function(t){return u(t)?2:d(t)?0:1},v=function(t,e,i){switch(p(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},g=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},f={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(g(t)),t=this.sections.join("\n"),this.lines=v(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(b,f,y,C);const w=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class S extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=p(this.parent),this.pageStartIndexes=[],this.lines=v(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(w(t,"maxLines",void 0)),this.setPageBreak(w(t,"pageBreak","\f\n")),this.setText(w(t,"text","")),this.startLineIndex=w(t,"start",-1),this.endLineIndex=w(t,"end",void 0);var e=w(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(p(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(S.prototype,b);var T={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(g(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},P=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},O=function(t,e){for(var i=void 0,s=0;s0?k(n,t,h=(a=i)-d,a):"";var c,u=e-d;u>0?(a=(h=0)+u,this.insertIndex=a,c=k(n,t,h,a)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},E={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var h=P(this.parent,t);n=O(h,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(E,T);const L=Phaser.Utils.Objects.GetFastValue,M=Phaser.Utils.Objects.GetValue;class R extends o{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(M(t,"wrap",!1)),this.setTypeMode(M(t,"typeMode",0)),this.setTypingSpeed(M(t,"speed",333)),this.setTextCallback=L(t,"setTextCallback",null),this.setTextCallbackScope=L(t,"setTextCallbackScope",null),this.setTypingContent(L(t,"text","")),this.typingIndex=L(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=L(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=D[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=g(t);this.textWrapEnable&&(e=function(t,e){switch(p(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=P(this.parent,this.text).length,this}onTyping(){var t=_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)}}const D={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(R.prototype,E);const I=Phaser.Utils.Objects.GetValue,z={page:0,line:1};var Y=!1,A=function(t){Y||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return W(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return F(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iG(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eG(t).x,getChildLocalY:t=>G(t).y};const ot=Phaser.Math.DegToRad;var lt={updateChildRotation(t){var e=G(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=G(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return G(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return G(t).rotation=ot(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=G(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>G(t).rotation},dt={updateChildScale(t){var e=G(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=G(t),i=e.parent;return e.scaleX=ht(t.scaleX,i.scaleX),e.scaleY=ht(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=G(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=G(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>G(t).scaleX,getChildLocalScaleY:t=>G(t).scaleY},ct={updateChildVisible(t){var e=G(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=G(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),G(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),G(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=G(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>G(t).visible},ut={updateChildAlpha(t){var e=G(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=G(t),i=e.parent;return e.alpha=ht(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return G(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=G(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>G(t).alpha},pt={updateChildActive(t){var e=G(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return G(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),G(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=G(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>G(t).active},vt={updateChildScrollFactor(t){var e=G(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},gt={updateCameraFilter(t){var e=G(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},ft={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},mt=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Ct=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const wt=Phaser.Utils.Array;var St={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},hi=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};const ai=/(\S+)\[(\d+)\]/i,oi=Phaser.Utils.Objects.GetValue;var li=function(t,e){return void 0===e?t:t[e]},di=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=oi(e,"left",0),t.right=oi(e,"right",0),t.top=oi(e,"top",0),t.bottom=oi(e,"bottom",0)),t},ci={getInnerPadding(t){return li(this.space,t)},setInnerPadding(t,e){return di(this.space,t,e),this},getOuterPadding(t){return li(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return di(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),li(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),di(this.getSizerConfig(t).padding,e,i),this}},ui=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},pi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},vi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},gi=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},fi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},mi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},yi={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},xi=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Fi:Wi,this.repeatCounter=0,this}stop(){return this.state=Xi,this}update(t,e){this.state!==Xi&&this.state!==ji&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Bi)):(this.nowTime=this.duration,this.state=ji):this.nowTime>=0&&(this.state=Fi))}get t(){var t;switch(this.state){case Xi:case Wi:case Bi:t=0;break;case Fi:t=this.nowTime/this.duration;break;case ji:t=1}return Yi(t,0,1)}set t(t){(t=Yi(t,-1,1))<0?(this.state=Wi,this.nowTime=-this.delay*t):(this.state=Fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Xi}get isDelay(){return this.state===Wi}get isCountDown(){return this.state===Fi}get isRunning(){return this.state===Wi||this.state===Fi}get isDone(){return this.state===ji}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Xi=0,Wi=1,Fi=2,Bi=3,ji=-1;class Hi extends Di{constructor(t,e){super(t,e),this.timer=new Ai}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Tweens.Builders.GetEaseFunction;class Vi extends Hi{resetFromJSON(t){return this.timer.resetFromJSON(Ni(t,"timer")),this.setEnable(Ni(t,"enable",!0)),this.setTarget(Ni(t,"target",this.parent)),this.setDelay(Ui(t,"delay",0)),this.setDuration(Ui(t,"duration",1e3)),this.setEase(Ni(t,"ease","Linear")),this.setRepeat(Ni(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Gi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ji=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Vi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),this.setScaleRange($i(t,"start",void 0),$i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=$i(t,"x",this.parent.scaleX),this.startY=$i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=$i(e,"x",void 0),this.endY=$i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=qi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Qi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Zi(t,a):r.resetFromJSON(a),r.restart(),r},ts=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Zi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Zi(t,h):n.resetFromJSON(h),n.restart(),n},es=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},is=function(t){return es(t,"complete")};const ss=Phaser.Utils.Objects.IsPlainObject;var rs={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ss(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Qi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),is(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ss(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ts(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),is(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),is(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ss(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Zi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),is(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ns={};Object.assign(ns,rs),ns.onInitScale=function(){rs.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const hs=Phaser.Utils.Objects.GetValue,as=Phaser.Utils.Objects.GetAdvancedValue,os=Phaser.Math.Linear;class ls extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(hs(t,"mode",0)),this.setAlphaRange(as(t,"start",this.parent.alpha),as(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ds[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=os(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ds={stop:0,destroy:1,yoyo:2},cs=Phaser.Utils.Objects.IsPlainObject;var us=function(t,e,i,s){var r,n;cs(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ls(t,h):s.resetFromJSON(h),s.restart(),s},ps=function(t,e,i,s){i instanceof ls&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ls(t,r):s.resetFromJSON(r),s.restart(),s};const vs=Phaser.Utils.Objects.IsPlainObject;var gs={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(vs(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=us(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),is(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(vs(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=ps(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),is(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),is(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},fs={};Object.assign(fs,gs),fs.onInitFade=function(){gs.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const ms=Phaser.Utils.Objects.GetValue,ys=Phaser.Utils.Objects.GetAdvancedValue,xs=Phaser.Math.Linear;class Cs extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(ms(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=ys(t,"x",void 0),i=ys(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=bs[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=ys(i,"startX",void 0),this.startY=ys(i,"startY",void 0),this.endX=ys(i,"endX",void 0),this.endY=ys(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=xs(this.startX,this.endX,i)),this.hasMoveY&&(t.y=xs(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const bs={stop:0,destroy:1,yoyo:2};var ws=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ss=Phaser.Utils.Objects.IsPlainObject,Ts=Phaser.Math.Distance.Between;var Ps={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ss(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Cs&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ws(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ws(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Cs(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),is(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),is(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ss(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Cs&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ws(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ws(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Cs(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),is(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),is(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Os={};Object.assign(Os,Ps),Os.onInitEaseMove=function(){Ps.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ks=Phaser.Utils.Objects.GetValue;class _s extends Li{constructor(t,e){super(t,e),this.timer=new Ai,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ks(t,"timer")),this.setEnable(ks(t,"enable",!0)),this.setMode(ks(t,"mode",1)),this.isRunning=ks(t,"isRunning",!1),this.setMagnitudeMode(ks(t,"magnitudeMode",1)),this.setAxisMode(ks(t,"axis",0)),this.setDuration(ks(t,"duration",500)),this.setMagnitude(ks(t,"magnitude",10)),this.ox=ks(t,"ox",void 0),this.oy=ks(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=Es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=Ms[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=Ls[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ks(i,"magnitude",void 0),t=ks(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const Es={effect:0,behavior:1},Ls={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Ms={constant:0,decay:1},Rs=Phaser.Utils.Objects.IsPlainObject;var Ds={shake(t,e,i){if(Rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new _s(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),is(this._shake)}};const Is=Phaser.Utils.Objects.GetValue,zs=Phaser.Math.Linear;class Ys extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Is(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Is(t,"from",i),this.toValue=Is(t,"to",i),this.setEase(Is(t,"ease",this.ease)),this.setDuration(Is(t,"duration",this.duration)),this.setRepeat(Is(t,"repeat",0)),this.setDelay(Is(t,"delay",0)),this.setRepeatDelay(Is(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=zs(this.fromValue,this.toValue,i)}}const As=Phaser.Utils.Objects.IsPlainObject;class Xs extends o{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new Ys(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(As(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(As(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var Ws={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new Xs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),es(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Fs=Phaser.Utils.Array.Remove,Bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ir={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,r,n){var h=s(t);return h.time.delayedCall(e,(function(){h.game.events.once("poststep",(function(){i.call(r,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},sr={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ye),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ye),this.transitOutCallback=t,this}},rr={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},nr={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},hr={};Object.assign(hr,ir,sr,rr,nr);const ar=Phaser.Utils.Objects.GetValue;class or extends o{constructor(t,e){super(t,e),this.setTransitInTime(ar(e,"duration.in",200)),this.setTransitOutTime(ar(e,"duration.out",200)),this.setTransitInCallback(ar(e,"transitIn")),this.setTransitOutCallback(ar(e,"transitOut")),this.oneShotMode=ar(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new er(this,{eventEmitter:!1,initState:ar(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(or.prototype,hr);var lr=function(t){if(t.parentContainer)return lr(t.parentContainer);var e=function(t){var e=t.displayList;return Et(e)?e:null}(t);return e?lr(e):t};class dr extends o{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=lr(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const cr=Phaser.GameObjects.Rectangle;class ur extends cr{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new dr(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const pr=Phaser.Utils.Objects.GetValue;class vr extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(pr(t,"hitAreaMode",0)),this.setEnable(pr(t,"enable",!0)),this.setStopMode(pr(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=gr[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var gr={default:0,fullWindow:1};const fr=Phaser.Utils.Objects.GetValue;class mr extends ur{constructor(t,e){super(t,fr(e,"color",0),fr(e,"alpha",.8)),this.touchEventStop=new vr(this,{hitAreaMode:1})}}var yr={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Qi(t,e)},scaleDown(t,e){ts(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,us(t,e)},fadeOut(t,e){ps(t,e,!1)}},xr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,us(t,e,t.alpha)},Cr=function(t,e){ps(t,e,!1)},br=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Ft(t,!0).contains(e,i)||r&&!r(t,e,i))};const wr=Phaser.Utils.Objects.GetValue;let Sr=class extends or{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Tr.popUp),null==e.transitOut&&(e.transitOut=Tr.scaleDown),e.destroy=wr(e,"destroy",!0),super(t,e);var i=wr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new mr(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(wr(i,"transitIn",xr)),this.setCoverTransitOutCallback(wr(i,"transitOut",Cr)));var s=wr(e,"touchOutsideClose",!1),r=wr(e,"duration.hold",-1),n=wr(e,"timeOutClose",r>=0),h=wr(e,"anyTouchClose",!1);wr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),wr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&br(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Tr[t]),t){case Tr.popUp:t=yr.popUp;break;case Tr.fadeIn:t=yr.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Tr[t]),t){case Tr.scaleDown:t=yr.scaleDown;break;case Tr.fadeOut:t=yr.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Pr=function(t){return t&&"function"==typeof t},Or={modal(t,e){return Pr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},kr=function(t,e,i,s,r){Pr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},_r={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return kr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return kr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return kr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return kr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return kr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return kr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return kr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return kr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return kr.call(this,"shutdown",t,e,i,s),this}},Er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Lr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Lr={},Mr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?br(t,e.x,e.y,i,s):!!(r=Er(e,n,!0))&&br(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const jr={press:0,pointerdown:0,release:1,pointerup:1};var Hr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Nr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Ur(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Gr.length=0,!0;return Gr.length=0,!1},Gr=[];const Vr=Phaser.Utils.Objects.GetValue;class Jr extends o{constructor(t,e){super(t,e),this._enable=void 0;var i=Vr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Vr(t,"enable",!0)),this.setMode(Vr(t,"mode",1)),this.setClickInterval(Vr(t,"clickInterval",100)),this.setDragThreshold(Vr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=$r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Nr:Mr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const $r={press:0,pointerdown:0,release:1,pointerup:1};var qr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Jr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Zr extends tr{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Kr=Phaser.Utils.Objects.GetValue;class Qr extends o{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Zr,this.parent.setInteractive(Kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Kr(t,"enable",!0)),this.setCooldown(Kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var tn={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Mr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Qr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Qr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},en={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},sn=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=xn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Cn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=xn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=bn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Mr(t,s,e,i)}}const xn=0,Cn=1,bn="IDLE",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.Distance.Between;class Tn extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Pn},eventEmitter:!1};this.setRecongizedStateObject(new tr(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(wn(t,"time",250)),this.setTapInterval(wn(t,"tapInterval",200)),this.setDragThreshold(wn(t,"threshold",9)),this.setTapOffset(wn(t,"tapOffset",10));var e=wn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(wn(t,"maxTaps",void 0)),this.setMinTaps(wn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Pn:this.state=On;break;case On:var t=this.lastPointer;Sn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=kn,this.state=On);break;case kn:this.state=On}}onDragEnd(){this.state===On&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=kn))}onDrag(){this.state!==Pn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Pn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===On){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Pn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=kn:this.state=Pn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=Pn)}get isTapped(){return this.state===kn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Pn="IDLE",On="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue;class En extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ln},eventEmitter:!1};this.setRecongizedStateObject(new tr(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(_n(t,"threshold",9)),this.setHoldTime(_n(t,"time",251)),this}onDragStart(){this.state=Mn,0===this.holdTime&&(this.state=Rn)}onDragEnd(){this.state=Ln}onDrag(){this.state!==Ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Mn&&t-this.pointer.downTime>=this.holdTime&&(this.state=Rn)}get isPressed(){return this.state===Rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Ln="IDLE",Mn="BEGIN",Rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.Distance.Between,In=Phaser.Math.Angle.Between;var zn={getDt:function(){var t;return t=this.scene,h(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return In(e.x,e.y,t.x,t.y)}},Yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},An={};const Xn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.RadToDeg;class Fn extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Bn},eventEmitter:!1};this.setRecongizedStateObject(new tr(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xn(t,"threshold",10)),this.setVelocityThreshold(Xn(t,"velocityThreshold",1e3)),this.setDirectionMode(Xn(t,"dir","8dir")),this}onDragStart(){this.state=jn}onDragEnd(){this.state=Bn}onDrag(){this.state===jn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Hn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Hn&&(this.state=Bn)}get isSwiped(){return this.state===Hn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=An),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Fn.prototype,zn);const Bn="IDLE",jn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue,Un=Phaser.Utils.Array.SpliceOne,Gn=Phaser.Math.Distance.Between,Vn=Phaser.Math.Angle.Between;class Jn{constructor(t,e){var i=s(t);i===t&&(t=void 0);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.gameObject=t,t&&t.setInteractive(Nn(e,"inputConfig",void 0)),this.setEventEmitter(Nn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Nn(t,"enable",!0)),this.bounds=Nn(t,"bounds",void 0),this.tracerState=qn,this.pointers.length=0,Zt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Zt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case qn:this.tracerState=Zn,this.onDrag1Start();break;case Zn:this.tracerState=Kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Un(this.pointers,e),this.tracerState){case Zn:this.tracerState=qn,this.onDrag1End();break;case Kn:this.tracerState=Zn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Zn:this.onDrag1();break;case Kn:this.onDrag2()}}}dragCancel(){return this.tracerState===Kn&&this.onDrag2End(),this.pointers.length=0,Zt(this.movedState),this.tracerState=qn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Gn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Vn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;$n.x=e.x-i.x,$n.y=e.y-i.y}else $n.x=0,$n.y=0;return $n}get centerX(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Mr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Mr(t,s,e,i)}}Object.assign(Jn.prototype,t);var $n={};const qn=0,Zn=1,Kn=2,Qn="IDLE";Phaser.Utils.Objects.GetValue;const th=Phaser.Math.RotateAround;var eh=function(t,e,i,s){return th(t,e,i,s),t.rotation+=s,t},ih={};const sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Math.Angle.WrapDegrees,nh=Phaser.Math.Angle.ShortestBetween,hh=Phaser.Math.RadToDeg,ah=Phaser.Math.DegToRad;var oh={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=ih),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=rh(hh(this.angleBetween));this.angle=nh(this.prevAngle,t),this.prevAngle=t,this.state=ch}break;case ch:t=rh(hh(this.angleBetween)),this.angle=nh(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===ch}get rotation(){return ah(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,oh);const lh="IDLE",dh="BEGIN",ch="RECOGNIZED",uh=Phaser.Utils.Objects.GetValue;var ph=function(t){var e=uh(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Tn(this,e),this._tap.on("tap",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const vh=Phaser.Utils.Objects.GetValue;var gh=function(t){var e=vh(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new En(this,e),this._press.on("pressstart",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const fh=Phaser.Utils.Objects.GetValue;var mh=function(t){var e=fh(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";rn(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const yh=Phaser.Utils.Objects.GetValue;var xh=function(t,e){return t.setInteractive(),yh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:yh(e,"targets",[t]),targetMode:yh(e,"targetMode","parent"),eventEmitter:yh(e,"eventEmitter",t),eventNamePrefix:yh(e,"inputEventPrefix","child.")},hn.call(t,e),ln.call(t,e),un.call(t,e),fn.call(t,e),ph.call(t,e),gh.call(t,e),mh.call(t,e),t},Ch={getSizerConfig:function(t){return void 0===t&&(t=this),ce(t)},getChildPrevState:function(t){var e=ce(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ve(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=je(e,"color"),s=je(e,"lineWidth");var o=je(e,"name",!1);o&&(r=je(o,"createTextCallback",Ne),n=je(o,"createTextCallbackScope",void 0),"string"==typeof(h=je(o,"align","left-top"))&&(h=me[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new He(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const Eh=Phaser.Utils.Objects.IsPlainObject,Lh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER,Rh={min:0,full:-1};var Dh=function(t,e,i,s,r,n,h,a,o,l){$e.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=Rh[e];else if(Eh(e)){var u;e=Lh(u=e,"proportion",void 0),i=Lh(u,"align",Mh),s=Lh(u,"padding",0),r=Lh(u,"expand",!1),n=Lh(u,"key",void 0),h=Lh(u,"index",void 0),t.isRexSizer||(a=Lh(u,"minWidth",void 0),o=Lh(u,"minHeight",void 0)),l=Lh(u,"fitRatio",0)}return"string"==typeof i&&(i=me[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=Mh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zt(t)/Yt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=Ve(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?zt(t):a:t.minHeight=void 0===o?Yt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},Ih={add:Dh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Dh.call(this,new kh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return Eh(i)&&(i.index=t),Dh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=_h.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const zh=de.prototype.clear;var Yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),zh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Yh.call(this,t),this}},Wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=me[e]),this.getSizerConfig(t).align=e,this}},Fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},jh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Hh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(wi(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,xi.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=gi.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||pi.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Ph.call(this,t,void 0),vi.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||fi.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Ph.call(this,void 0,t),mi.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Hh,Ih,Xh,Wh,Fh,Bh,jh);var Nh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Uh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Gh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Jh extends wh{constructor(t,e,i,s,r,n,h){Gh(e)?(e=Vh(h=e,"x",0),i=Vh(h,"y",0),s=Vh(h,"width",void 0),r=Vh(h,"height",void 0),n=Vh(h,"orientation",0)):Gh(s)?(s=Vh(h=s,"width",void 0),r=Vh(h,"height",void 0),n=Vh(h,"orientation",0)):Gh(n)&&(n=Vh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Vh(h,"space.item",0)),this.setStartChildIndex(Vh(h,"startChildIndex",0)),this.setRTL(Vh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Uh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Nh.call(this)),this._childrenProportion}}Object.assign(Jh.prototype,Hh);var $h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},qh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Zh extends Jh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&($h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&($h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&$h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&$h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Zh.prototype,qh);var Kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Qh=Phaser.GameObjects.Graphics;class ta extends Qh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=Ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&Kt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Kh.call(this,this.width,this.height,this.padding,t,e)),this}}const ea={rectangle:0,circle:1};var ia=function(t,e,i,s){var r=new ta(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Utils.Objects.GetValue;var na=/^[\x00-\x7F]+$/,ha=function(t){return na.test(t)},aa=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},la=2;const da={none:0,word:1,char:la,character:la,mix:3};var ca=function(t,e){switch(p(t)){case 0:switch("string"==typeof e&&(e=da[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=aa;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=da[e]||0),t.style.wrapMode=e}};const ua=Phaser.Renderer.WebGL.Utils;var pa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ua.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const va=Phaser.Display.Color;var ga={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new va);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},fa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};A();const ma=Phaser.Display.Canvas.CanvasPool,ya=Phaser.GameObjects.GameObject,xa=Phaser.Utils.String.UUID;class Ca extends ya{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ma.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=xa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ma.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ba=Phaser.GameObjects.Components;Phaser.Class.mixin(Ca,[ba.Alpha,ba.BlendMode,ba.Crop,ba.Depth,ba.Flip,ba.GetBounds,ba.Mask,ba.Origin,ba.Pipeline,ba.PostPipeline,ba.ScrollFactor,ba.Tint,ba.Transform,ba.Visible,pa,ga,fa]);var wa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:$s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Zt(this.data),this}};class Sa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Sa.prototype,wa);var Ta={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Pa=Phaser.Math.RotateAround;var Oa;const ka=Phaser.Geom.Rectangle;var _a,Ea=function(t){void 0===_a&&(_a=new ka);var e=t.drawTLX,i=t.drawTLY;return _a.setTo(e,i,t.drawTRX-e,t.drawBLY-i),_a};const La=Phaser.Math.RotateAround;var Ma,Ra=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ma&&(Ma={}),s=Ma),s.x=e,s.y=i,0!==t.rotation&&La(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Da=Phaser.GameObjects.Components.TransformMatrix;var Ia,za,Ya={},Aa=function(t,e,i,s,r){var n=Ra(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ya);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ia&&(Ia=new Da,za=new Da),t.parentContainer?t.getWorldTransformMatrix(Ia,za):Ia.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ia.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Xa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Aa(t,e,n,h,r)},Wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Pa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ea(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Xa(this.parent,this,t,e,i)}};Object.assign(Wa,Ta);const Fa=Phaser.Math.DegToRad,Ba=Phaser.Math.RadToDeg,ja=Phaser.Utils.Objects.GetValue;class Ha extends Sa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ba(this._rotation)}set angle(t){this.rotation=Fa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ja(t,"width",void 0),i=ja(t,"height",void 0),s=ja(t,"scaleX",void 0),r=ja(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ha.prototype,Wa);const Na=Phaser.Utils.String.Pad;var Ua=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Na(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ga=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Va=Phaser.Utils.Objects.GetValue;class Ja{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Va(t,"x",0),i=Va(t,"y",0));var s=this.cornerRadius;s.tl=$a(Va(t,"tl",void 0),e,i),s.tr=$a(Va(t,"tr",void 0),e,i),s.bl=$a(Va(t,"bl",void 0),e,i),s.br=$a(Va(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){qa(this.cornerRadius.br,t)}}var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Za(t),t},qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Va(e,"x",0),t.y=Va(e,"y",0)),Za(t)},Za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ka=Phaser.Math.DegToRad;var Qa=function(t){return!t.hasOwnProperty("convex")||t.convex},to=function(t){return t.x>0&&t.y>0},eo=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,o,l,o,l,180,270,!1,h):eo(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,s-o,l,o,l,270,360,!1,h):eo(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,s-o,r-l,o,l,0,90,!1,h):eo(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,o,r-l,o,l,90,180,!1,h):eo(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const so=Phaser.Utils.Objects.GetValue;class ro extends Ha{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(so(e,"color",null),so(e,"color2",null),so(e,"horizontalGradient",!0)),this.setStroke(so(e,"stroke",null),so(e,"strokeThickness",2)),this.setCornerRadius(so(e,"cornerRadius",0),so(e,"cornerIteration",null))}set color(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ga("color2",t,this),Ga("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ga("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),io(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const no=Phaser.Utils.Objects.GetValue;class ho extends Ha{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(no(e,"color",null),no(e,"color2",null),no(e,"horizontalGradient",!0)),this.setStroke(no(e,"stroke",null),no(e,"strokeThickness",2))}set color(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,no(t,"color2",null),no(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,no(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const ao=Phaser.Utils.Objects.GetValue;class oo{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ao(t,"bold",!1)),this.setItalic(ao(t,"italic",!1)),this.setFontSize(ao(t,"fontSize","16px")),this.setFontFamily(ao(t,"fontFamily","Courier")),this.setColor(ao(t,"color","#fff")),this.setStrokeStyle(ao(t,"stroke",null),ao(t,"strokeThickness",0)),this.setShadow(ao(t,"shadowColor",null),ao(t,"shadowOffsetX",0),ao(t,"shadowOffsetY",0),ao(t,"shadowBlur",0)),this.setOffset(ao(t,"offsetX",0),ao(t,"offsetY",0)),this.setSpace(ao(t,"leftSpace",0),ao(t,"rightSpace",0)),this.setAlign(ao(t,"align",void 0)),this.setBackgroundColor(ao(t,"backgroundColor",null)),this.setBackgroundHeight(ao(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ao(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ga("stroke",t,this),Ga("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ga("shadowOffsetX",t,this),Ga("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new oo(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ua(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ua(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ua(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ua(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const lo=Phaser.Utils.Array.Remove,co=Phaser.Utils.Array.Remove,uo="text",po="image",vo="drawer",go="space",fo="command";var mo=function(t){return t.type===uo&&"\n"===t.text},yo=function(t){return t.type===uo&&"\f"===t.text},xo=function(t){return t.type===uo};class Co extends Ha{constructor(t,e,i){super(t,uo),this.updateTextFlag=!1,this.style=new oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var bo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const wo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class So extends Ha{constructor(t,e,i){super(t,po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=wo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),wo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class To extends Ha{constructor(t,e,i,s){super(t,vo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Po extends Ha{constructor(t,e){super(t,go),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Oo extends Sa{constructor(t,e,i,s,r){super(t,fo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ko(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ko(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ko(t[i]));return e}var _o=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Eo={none:0,word:1,char:2,character:2,mix:3};var Lo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Io.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Io.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Yo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Yo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Yo(t,"wrapMode");void 0===c&&(c=Yo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Eo[c]);var u=Yo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Yo(t,"letterSpacing",0),v=Yo(t,"hAlign",0),g=Yo(t,"vAlign",0),f=Yo(t,"justifyPercentage",.25),m=_o({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,C=y.length;x0&&(E.push({children:L,width:M}),R=Math.max(R,M)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=R,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Wo(t,"maxLines",0);var a=0===i,o=Wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Wo(t,"letterSpacing",0),p=Wo(t,"rtl",!0),v=Wo(t,"hAlign",p?2:0),g=Wo(t,"vAlign",0),f=_o({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:L}),M=Math.max(M,L)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=M,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return di(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return li(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),lo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return co(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(uo);return null===i?i=new Co(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Xa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const dl=Phaser.Utils.Objects.GetFastValue;var cl={};class ul{constructor(t){this.pools=dl(t,"pools",cl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ll),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Cl(t,r,e,i,n),a=0;a<=ml&&0!==h;a++){if((r+=h)<0){r=0;break}h=Cl(t,r,e,i,n)}return a===ml&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),bl(t,e,i),t},xl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Cl=function(t,e,i,s,r){var n,h=xl(t,e,r),a=xl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},bl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const wl=Phaser.Utils.Objects.GetValue;var Sl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=wl(e,"minWidth",0),s=wl(e,"minHeight",0),r=wl(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return yl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),yl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Tl=Phaser.Utils.Objects.GetValue,Pl=[function(t){var e=this.scene,i=sa(t,"orientation",0);this.setOrientation(i);var s=sa(t,"icon",void 0),r=sa(t,"iconMask",void 0),n=sa(t,"innerBackground",void 0),h=sa(t,"title",void 0),a=sa(t,"separator",void 0),o=sa(t,"text",void 0),l=sa(t,"action",void 0),d=sa(t,"actionMask",void 0);if(s){var c=sa(t,"align.icon","center");m=0===this.orientation?{right:sa(t,"space.icon",0),top:sa(t,"space.iconTop",0),bottom:sa(t,"space.iconBottom",0),left:sa(t,"space.iconLeft",0)}:{bottom:sa(t,"space.icon",0),left:sa(t,"space.iconLeft",0),right:sa(t,"space.iconRight",0),top:sa(t,"space.iconTop",0)};var u=sa(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=ia.call(this,s,s,1)),!u){var p=sa(t,"iconSize",void 0);this.setIconSize(sa(t,"iconWidth",p),sa(t,"iconHeight",p))}}var v=new Jh(e,{orientation:1});n&&v.addBackground(n);var g=sa(t,"space.separator",0);if(h){c=sa(t,"align.title","left");var f=sa(t,"expandTitleWidth",!1);y=sa(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?sa(t,"space.title",g):0,left:sa(t,"space.titleLeft",0),right:sa(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:sa(t,"space.separatorLeft",0),right:sa(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=sa(t,"align.text","left");var y,x,C=sa(t,"expandTextWidth",!1);y=sa(t,"expandTextHeight",!1)?1:0,x=C,m={left:sa(t,"space.textLeft",0),right:sa(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:sa(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=sa(t,"align.action","center"),m=0===this.orientation?{top:sa(t,"space.actionTop",0),bottom:sa(t,"space.actionBottom",0),right:sa(t,"space.actionRight",0)}:{left:sa(t,"space.actionLeft",0),right:sa(t,"space.actionRight",0),bottom:sa(t,"space.actionBottom",0)},u=sa(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=ia.call(this,l,l,1)),!u)){var b=sa(t,"actionSize");this.setActionSize(sa(t,"actionWidth",b),sa(t,"actionHeight",b))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=ra(t,"title",void 0),s=ra(t,"separator",void 0),r=ra(t,"innerBackground",void 0),n=ra(t,"icon",void 0),h=ra(t,"iconMask",void 0),a=ra(t,"text",void 0),o=ra(t,"action",void 0),l=ra(t,"actionMask",void 0);if(i){var d=ra(t,"align.title","left"),c=ra(t,"expandTitleWidth",!1);y=ra(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:ra(t,"space.title",0),left:ra(t,"space.titleLeft",0),right:ra(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=ra(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:ra(t,"space.separatorLeft",0),right:ra(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=ra(t,"orientation",0),g=new Jh(e,{orientation:v,rtl:ra(t,"rtl",!1),space:{left:ra(t,"space.innerLeft",0),right:ra(t,"space.innerRight",0),top:ra(t,"space.innerTop",0),bottom:ra(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=ra(t,"align.icon","center"),p=0===g.orientation?{right:ra(t,"space.icon",0),top:ra(t,"space.iconTop",0),bottom:ra(t,"space.iconBottom",0),left:ra(t,"space.iconLeft",0)}:{bottom:ra(t,"space.icon",0),left:ra(t,"space.iconLeft",0),right:ra(t,"space.iconRight",0),top:ra(t,"space.iconTop",0)};var f=ra(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=ia.call(this,n,n,1)),!f){var m=ra(t,"iconSize",void 0);this.setIconSize(ra(t,"iconWidth",m),ra(t,"iconHeight",m))}}if(a){d=ra(t,"align.text","left");var y,x,C=ra(t,"space.text",0),b=ra(t,"expandTextWidth",!1),w=ra(t,"expandTextHeight",!1);0===g.orientation?(y=b?1:0,o&&(p={right:C}),x=w):(y=w?1:0,o&&(p={bottom:C}),x=b),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=ra(t,"align.action","center"),p=0===g.orientation?{top:ra(t,"space.actionTop",0),bottom:ra(t,"space.actionBottom",0),right:ra(t,"space.actionRight",0)}:{left:ra(t,"space.actionLeft",0),right:ra(t,"space.actionRight",0),bottom:ra(t,"space.actionBottom",0)},f=ra(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=ia.call(this,o,o,1)),!f)){var S=ra(t,"actionSize");this.setActionSize(ra(t,"actionWidth",S),ra(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];class Ol extends Zh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Tl(e,"background",void 0);i&&this.addBackground(i);var s=Tl(e,"title",void 0),r=Tl(e,"text",void 0);if(s){var n=Tl(e,"wrapTitle",!1),h=Tl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),ca(s,n),e.expandTitleWidth=!0,fl(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Sl(s,{fitHeight:!0}))}if(r){var a=Tl(e,"wrapText",!1),o=Tl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),ca(r,a),e.expandTextWidth=!0,fl(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Sl(r,{fitHeight:!0}))}var l=Tl(e,"layoutMode",0);(Pl[l]||Pl[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class kl extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=I(i,"expandTextWidth",!1),n=I(i,"expandTextHeight",!1);if(r||n){var h=p(s);switch(h){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,h=n?e:0;s.setFixedSize(i,h),i>0&&s.setWordWrapWidth(i)},1===h){var a=s.style;0===a.wrapMode&&(a.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(I(i,"typingMode","page")),this.page=new S(s,I(i,"page",void 0)),this.typing=new R(s,I(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=z[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Ol)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}return kl},"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(); +var t,e;t=void 0,e=function(){var t={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const e=Phaser.Scene;var i=function(t){return t instanceof e},s=function(t){return null==t||"object"!=typeof t?null:i(t)?t:t.scene&&i(t.scene)?t.scene:t.parent&&t.parent.scene&&i(t.parent.scene)?t.parent.scene:null};const r=Phaser.Game;var n=function(t){return t instanceof r},h=function(t){return null==t||"object"!=typeof t?null:n(t)?t:n(t.game)?t.game:i(t)?t.sys.game:i(t.scene)?t.scene.sys.game:void 0};const a=Phaser.Utils.Objects.GetValue;class o{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(a(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=s(t),this.game=h(t),this}}Object.assign(o.prototype,t);const l=Phaser.GameObjects.Text;var d=function(t){return t instanceof l};const c=Phaser.GameObjects.BitmapText;var u=function(t){return t instanceof c},p=function(t){return u(t)?2:d(t)?0:1},v=function(t,e,i){switch(p(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},g=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},f={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(g(t)),t=this.sections.join("\n"),this.lines=v(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(b,f,y,C);const w=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class S extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=p(this.parent),this.pageStartIndexes=[],this.lines=v(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(w(t,"maxLines",void 0)),this.setPageBreak(w(t,"pageBreak","\f\n")),this.setText(w(t,"text","")),this.startLineIndex=w(t,"start",-1),this.endLineIndex=w(t,"end",void 0);var e=w(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(p(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(S.prototype,b);var T={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(g(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},P=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},O=function(t,e){for(var i=void 0,s=0;s0?k(n,t,h=(a=i)-d,a):"";var c,u=e-d;u>0?(a=(h=0)+u,this.insertIndex=a,c=k(n,t,h,a)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},E={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var h=P(this.parent,t);n=O(h,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(E,T);const L=Phaser.Utils.Objects.GetFastValue,M=Phaser.Utils.Objects.GetValue;class R extends o{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(M(t,"wrap",!1)),this.setTypeMode(M(t,"typeMode",0)),this.setTypingSpeed(M(t,"speed",333)),this.setTextCallback=L(t,"setTextCallback",null),this.setTextCallbackScope=L(t,"setTextCallbackScope",null),this.setTypingContent(L(t,"text","")),this.typingIndex=L(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=L(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=D[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=g(t);this.textWrapEnable&&(e=function(t,e){switch(p(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=P(this.parent,this.text).length,this}onTyping(){var t=_.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?x(this.parent,t):this.parent.setText(t)}}const D={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(R.prototype,E);const I=Phaser.Utils.Objects.GetValue,z={page:0,line:1};var Y=!1,X=function(t){Y||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return W(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return F(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iG(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eG(t).x,getChildLocalY:t=>G(t).y};const ot=Phaser.Math.DegToRad;var lt={updateChildRotation(t){var e=G(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=G(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return G(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return G(t).rotation=ot(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=G(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>G(t).rotation},dt={updateChildScale(t){var e=G(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=G(t),i=e.parent;return e.scaleX=ht(t.scaleX,i.scaleX),e.scaleY=ht(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=G(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=G(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>G(t).scaleX,getChildLocalScaleY:t=>G(t).scaleY},ct={updateChildVisible(t){var e=G(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=G(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),G(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),G(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=G(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>G(t).visible},ut={updateChildAlpha(t){var e=G(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=G(t),i=e.parent;return e.alpha=ht(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return G(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=G(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>G(t).alpha},pt={updateChildActive(t){var e=G(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return G(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),G(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=G(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>G(t).active},vt={updateChildScrollFactor(t){var e=G(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},gt={updateCameraFilter(t){var e=G(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},ft={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},mt=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Ct=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const wt=Phaser.Utils.Array;var St={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},hi=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};const ai=/(\S+)\[(\d+)\]/i,oi=Phaser.Utils.Objects.GetValue;var li=function(t,e){return void 0===e?t:t[e]},di=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=oi(e,"left",0),t.right=oi(e,"right",0),t.top=oi(e,"top",0),t.bottom=oi(e,"bottom",0)),t},ci={getInnerPadding(t){return li(this.space,t)},setInnerPadding(t,e){return di(this.space,t,e),this},getOuterPadding(t){return li(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return di(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),li(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),di(this.getSizerConfig(t).padding,e,i),this}},ui=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},pi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},vi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},gi=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},fi=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},mi=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},yi={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},xi=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Fi:Wi,this.repeatCounter=0,this}stop(){return this.state=Ai,this}update(t,e){this.state!==Ai&&this.state!==ji&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Bi)):(this.nowTime=this.duration,this.state=ji):this.nowTime>=0&&(this.state=Fi))}get t(){var t;switch(this.state){case Ai:case Wi:case Bi:t=0;break;case Fi:t=this.nowTime/this.duration;break;case ji:t=1}return Yi(t,0,1)}set t(t){(t=Yi(t,-1,1))<0?(this.state=Wi,this.nowTime=-this.delay*t):(this.state=Fi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ai}get isDelay(){return this.state===Wi}get isCountDown(){return this.state===Fi}get isRunning(){return this.state===Wi||this.state===Fi}get isDone(){return this.state===ji}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ai=0,Wi=1,Fi=2,Bi=3,ji=-1;class Hi extends Di{constructor(t,e){super(t,e),this.timer=new Xi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Tweens.Builders.GetEaseFunction;class Vi extends Hi{resetFromJSON(t){return this.timer.resetFromJSON(Ni(t,"timer")),this.setEnable(Ni(t,"enable",!0)),this.setTarget(Ni(t,"target",this.parent)),this.setDelay(Ui(t,"delay",0)),this.setDuration(Ui(t,"duration",1e3)),this.setEase(Ni(t,"ease","Linear")),this.setRepeat(Ni(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Gi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ji=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Vi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),this.setScaleRange($i(t,"start",void 0),$i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=$i(t,"x",this.parent.scaleX),this.startY=$i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=$i(e,"x",void 0),this.endY=$i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=qi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Qi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Zi(t,a):r.resetFromJSON(a),r.restart(),r},ts=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Zi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Zi(t,h):n.resetFromJSON(h),n.restart(),n},es=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},is=function(t){return es(t,"complete")};const ss=Phaser.Utils.Objects.IsPlainObject;var rs={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(ss(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Qi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),is(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ss(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ts(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),is(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),is(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ss(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Zi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),is(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ns={};Object.assign(ns,rs),ns.onInitScale=function(){rs.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const hs=Phaser.Utils.Objects.GetValue,as=Phaser.Utils.Objects.GetAdvancedValue,os=Phaser.Math.Linear;class ls extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(hs(t,"mode",0)),this.setAlphaRange(as(t,"start",this.parent.alpha),as(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ds[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=os(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ds={stop:0,destroy:1,yoyo:2},cs=Phaser.Utils.Objects.IsPlainObject;var us=function(t,e,i,s){var r,n;cs(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ls(t,h):s.resetFromJSON(h),s.restart(),s},ps=function(t,e,i,s){i instanceof ls&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ls(t,r):s.resetFromJSON(r),s.restart(),s};const vs=Phaser.Utils.Objects.IsPlainObject;var gs={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(vs(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=us(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),is(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(vs(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=ps(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),is(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),is(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},fs={};Object.assign(fs,gs),fs.onInitFade=function(){gs.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const ms=Phaser.Utils.Objects.GetValue,ys=Phaser.Utils.Objects.GetAdvancedValue,xs=Phaser.Math.Linear;class Cs extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(ms(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=ys(t,"x",void 0),i=ys(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=bs[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=ys(i,"startX",void 0),this.startY=ys(i,"startY",void 0),this.endX=ys(i,"endX",void 0),this.endY=ys(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=xs(this.startX,this.endX,i)),this.hasMoveY&&(t.y=xs(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const bs={stop:0,destroy:1,yoyo:2};var ws=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Ss=Phaser.Utils.Objects.IsPlainObject,Ts=Phaser.Math.Distance.Between;var Ps={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Ss(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Cs&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ws(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ws(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Cs(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),is(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),is(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Ss(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Cs&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ws(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ws(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Cs(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),is(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),is(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Os={};Object.assign(Os,Ps),Os.onInitEaseMove=function(){Ps.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ke.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ks=Phaser.Utils.Objects.GetValue;class _s extends Li{constructor(t,e){super(t,e),this.timer=new Xi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ks(t,"timer")),this.setEnable(ks(t,"enable",!0)),this.setMode(ks(t,"mode",1)),this.isRunning=ks(t,"isRunning",!1),this.setMagnitudeMode(ks(t,"magnitudeMode",1)),this.setAxisMode(ks(t,"axis",0)),this.setDuration(ks(t,"duration",500)),this.setMagnitude(ks(t,"magnitude",10)),this.ox=ks(t,"ox",void 0),this.oy=ks(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=Es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=Ms[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=Ls[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ks(i,"magnitude",void 0),t=ks(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const Es={effect:0,behavior:1},Ls={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Ms={constant:0,decay:1},Rs=Phaser.Utils.Objects.IsPlainObject;var Ds={shake(t,e,i){if(Rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new _s(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),is(this._shake)}};const Is=Phaser.Utils.Objects.GetValue,zs=Phaser.Math.Linear;class Ys extends Vi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Is(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Is(t,"from",i),this.toValue=Is(t,"to",i),this.setEase(Is(t,"ease",this.ease)),this.setDuration(Is(t,"duration",this.duration)),this.setRepeat(Is(t,"repeat",0)),this.setDelay(Is(t,"delay",0)),this.setRepeatDelay(Is(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=zs(this.fromValue,this.toValue,i)}}const Xs=Phaser.Utils.Objects.IsPlainObject;class As extends o{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new Ys(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(Xs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(Xs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var Ws={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new As(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),es(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Fs=Phaser.Utils.Array.Remove,Bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var ir={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,r,n){var h=s(t);return h.time.delayedCall(e,(function(){h.game.events.once("poststep",(function(){i.call(r,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},sr={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ye),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ye),this.transitOutCallback=t,this}},rr={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},nr={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},hr={};Object.assign(hr,ir,sr,rr,nr);const ar=Phaser.Utils.Objects.GetValue;class or extends o{constructor(t,e){super(t,e),this.setTransitInTime(ar(e,"duration.in",200)),this.setTransitOutTime(ar(e,"duration.out",200)),this.setTransitInCallback(ar(e,"transitIn")),this.setTransitOutCallback(ar(e,"transitOut")),this.oneShotMode=ar(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new er(this,{eventEmitter:!1,initState:ar(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(or.prototype,hr);var lr=function(t){if(t.parentContainer)return lr(t.parentContainer);var e=function(t){var e=t.displayList;return Et(e)?e:null}(t);return e?lr(e):t};class dr extends o{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=lr(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const cr=Phaser.GameObjects.Rectangle;class ur extends cr{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new dr(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const pr=Phaser.Utils.Objects.GetValue;class vr extends o{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(pr(t,"hitAreaMode",0)),this.setEnable(pr(t,"enable",!0)),this.setStopMode(pr(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=gr[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var gr={default:0,fullWindow:1};const fr=Phaser.Utils.Objects.GetValue;class mr extends ur{constructor(t,e){super(t,fr(e,"color",0),fr(e,"alpha",.8)),this.touchEventStop=new vr(this,{hitAreaMode:1})}}var yr={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Qi(t,e)},scaleDown(t,e){ts(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,us(t,e)},fadeOut(t,e){ps(t,e,!1)}},xr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,us(t,e,t.alpha)},Cr=function(t,e){ps(t,e,!1)},br=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Ft(t,!0).contains(e,i)||r&&!r(t,e,i))};const wr=Phaser.Utils.Objects.GetValue;let Sr=class extends or{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Tr.popUp),null==e.transitOut&&(e.transitOut=Tr.scaleDown),e.destroy=wr(e,"destroy",!0),super(t,e);var i=wr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new mr(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(wr(i,"transitIn",xr)),this.setCoverTransitOutCallback(wr(i,"transitOut",Cr)));var s=wr(e,"touchOutsideClose",!1),r=wr(e,"duration.hold",-1),n=wr(e,"timeOutClose",r>=0),h=wr(e,"anyTouchClose",!1);wr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),wr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&br(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Tr[t]),t){case Tr.popUp:t=yr.popUp;break;case Tr.fadeIn:t=yr.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Tr[t]),t){case Tr.scaleDown:t=yr.scaleDown;break;case Tr.fadeOut:t=yr.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Pr=function(t){return t&&"function"==typeof t},Or={modal(t,e){return Pr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},kr=function(t,e,i,s,r){Pr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},_r={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return kr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return kr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return kr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return kr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return kr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return kr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return kr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return kr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return kr.call(this,"shutdown",t,e,i,s),this}},Er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Lr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Lr={},Mr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?br(t,e.x,e.y,i,s):!!(r=Er(e,n,!0))&&br(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const jr={press:0,pointerdown:0,release:1,pointerup:1};var Hr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Nr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Ur(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Gr.length=0,!0;return Gr.length=0,!1},Gr=[];const Vr=Phaser.Utils.Objects.GetValue;class Jr extends o{constructor(t,e){super(t,e),this._enable=void 0;var i=Vr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Vr(t,"enable",!0)),this.setMode(Vr(t,"mode",1)),this.setClickInterval(Vr(t,"clickInterval",100)),this.setDragThreshold(Vr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=$r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Nr:Mr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const $r={press:0,pointerdown:0,release:1,pointerup:1};var qr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Jr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Zr extends tr{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Kr=Phaser.Utils.Objects.GetValue;class Qr extends o{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Zr,this.parent.setInteractive(Kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Kr(t,"enable",!0)),this.setCooldown(Kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var tn={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Mr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Qr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Qr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},en={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},sn=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=xn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Cn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=xn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=bn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Mr(t,s,e,i)}}const xn=0,Cn=1,bn="IDLE",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.Distance.Between;class Tn extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Pn},eventEmitter:!1};this.setRecongizedStateObject(new tr(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(wn(t,"time",250)),this.setTapInterval(wn(t,"tapInterval",200)),this.setDragThreshold(wn(t,"threshold",9)),this.setTapOffset(wn(t,"tapOffset",10));var e=wn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(wn(t,"maxTaps",void 0)),this.setMinTaps(wn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Pn:this.state=On;break;case On:var t=this.lastPointer;Sn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=kn,this.state=On);break;case kn:this.state=On}}onDragEnd(){this.state===On&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=kn))}onDrag(){this.state!==Pn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Pn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===On){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Pn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=kn:this.state=Pn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=Pn)}get isTapped(){return this.state===kn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Pn="IDLE",On="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue;class En extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ln},eventEmitter:!1};this.setRecongizedStateObject(new tr(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(_n(t,"threshold",9)),this.setHoldTime(_n(t,"time",251)),this}onDragStart(){this.state=Mn,0===this.holdTime&&(this.state=Rn)}onDragEnd(){this.state=Ln}onDrag(){this.state!==Ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Mn&&t-this.pointer.downTime>=this.holdTime&&(this.state=Rn)}get isPressed(){return this.state===Rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Ln="IDLE",Mn="BEGIN",Rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.Distance.Between,In=Phaser.Math.Angle.Between;var zn={getDt:function(){var t;return t=this.scene,h(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return In(e.x,e.y,t.x,t.y)}},Yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Xn={};const An=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.RadToDeg;class Fn extends yn{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Bn},eventEmitter:!1};this.setRecongizedStateObject(new tr(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(An(t,"threshold",10)),this.setVelocityThreshold(An(t,"velocityThreshold",1e3)),this.setDirectionMode(An(t,"dir","8dir")),this}onDragStart(){this.state=jn}onDragEnd(){this.state=Bn}onDrag(){this.state===jn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Hn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Hn&&(this.state=Bn)}get isSwiped(){return this.state===Hn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Fn.prototype,zn);const Bn="IDLE",jn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue,Un=Phaser.Utils.Array.SpliceOne,Gn=Phaser.Math.Distance.Between,Vn=Phaser.Math.Angle.Between;class Jn{constructor(t,e){var i=s(t);i===t&&(t=void 0);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.gameObject=t,t&&t.setInteractive(Nn(e,"inputConfig",void 0)),this.setEventEmitter(Nn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Nn(t,"enable",!0)),this.bounds=Nn(t,"bounds",void 0),this.tracerState=qn,this.pointers.length=0,Zt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Zt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case qn:this.tracerState=Zn,this.onDrag1Start();break;case Zn:this.tracerState=Kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Un(this.pointers,e),this.tracerState){case Zn:this.tracerState=qn,this.onDrag1End();break;case Kn:this.tracerState=Zn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Zn:this.onDrag1();break;case Kn:this.onDrag2()}}}dragCancel(){return this.tracerState===Kn&&this.onDrag2End(),this.pointers.length=0,Zt(this.movedState),this.tracerState=qn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Gn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Vn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;$n.x=e.x-i.x,$n.y=e.y-i.y}else $n.x=0,$n.y=0;return $n}get centerX(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Mr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Mr(t,s,e,i)}}Object.assign(Jn.prototype,t);var $n={};const qn=0,Zn=1,Kn=2,Qn="IDLE";Phaser.Utils.Objects.GetValue;const th=Phaser.Math.RotateAround;var eh=function(t,e,i,s){return th(t,e,i,s),t.rotation+=s,t},ih={};const sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Math.Angle.WrapDegrees,nh=Phaser.Math.Angle.ShortestBetween,hh=Phaser.Math.RadToDeg,ah=Phaser.Math.DegToRad;var oh={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=ih),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=rh(hh(this.angleBetween));this.angle=nh(this.prevAngle,t),this.prevAngle=t,this.state=ch}break;case ch:t=rh(hh(this.angleBetween)),this.angle=nh(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===ch}get rotation(){return ah(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,oh);const lh="IDLE",dh="BEGIN",ch="RECOGNIZED",uh=Phaser.Utils.Objects.GetValue;var ph=function(t){var e=uh(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Tn(this,e),this._tap.on("tap",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const vh=Phaser.Utils.Objects.GetValue;var gh=function(t){var e=vh(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new En(this,e),this._press.on("pressstart",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){rn(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const fh=Phaser.Utils.Objects.GetValue;var mh=function(t){var e=fh(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";rn(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const yh=Phaser.Utils.Objects.GetValue;var xh=function(t,e){return t.setInteractive(),yh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:yh(e,"targets",[t]),targetMode:yh(e,"targetMode","parent"),eventEmitter:yh(e,"eventEmitter",t),eventNamePrefix:yh(e,"inputEventPrefix","child.")},hn.call(t,e),ln.call(t,e),un.call(t,e),fn.call(t,e),ph.call(t,e),gh.call(t,e),mh.call(t,e),t},Ch={getSizerConfig:function(t){return void 0===t&&(t=this),ce(t)},getChildPrevState:function(t){var e=ce(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=ve(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=je(e,"color"),s=je(e,"lineWidth");var o=je(e,"name",!1);o&&(r=je(o,"createTextCallback",Ne),n=je(o,"createTextCallbackScope",void 0),"string"==typeof(h=je(o,"align","left-top"))&&(h=me[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new He(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const Eh=Phaser.Utils.Objects.IsPlainObject,Lh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER,Rh={min:0,full:-1};var Dh=function(t,e,i,s,r,n,h,a,o,l,d,c){$e.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=Rh[e];else if(Eh(e)){var v;e=Lh(v=e,"proportion",void 0),i=Lh(v,"align",Mh),s=Lh(v,"padding",0),r=Lh(v,"expand",!1),n=Lh(v,"key",void 0),h=Lh(v,"index",void 0),t.isRexSizer||(a=Lh(v,"minWidth",void 0),o=Lh(v,"minHeight",void 0)),l=Lh(v,"fitRatio",0),d=Lh(v,"offsetX",0),c=Lh(v,"offsetY",0)}return"string"==typeof i&&(i=me[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=Mh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zt(t)/Yt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=Ve(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?zt(t):a:t.minHeight=void 0===o?Yt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},Ih={add:Dh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Dh.call(this,new kh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return Eh(i)&&(i.index=t),Dh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=_h.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const zh=de.prototype.clear;var Yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),zh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Yh.call(this,t),this}},Wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=me[e]),this.getSizerConfig(t).align=e,this}},Fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},jh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Hh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(wi(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,xi.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=gi.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||pi.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Ph.call(this,t,void 0),vi.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||fi.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Ph.call(this,void 0,t),mi.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Hh,Ih,Ah,Wh,Fh,Bh,jh);var Nh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Uh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Gh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Jh extends wh{constructor(t,e,i,s,r,n,h){Gh(e)?(e=Vh(h=e,"x",0),i=Vh(h,"y",0),s=Vh(h,"width",void 0),r=Vh(h,"height",void 0),n=Vh(h,"orientation",0)):Gh(s)?(s=Vh(h=s,"width",void 0),r=Vh(h,"height",void 0),n=Vh(h,"orientation",0)):Gh(n)&&(n=Vh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Vh(h,"space.item",0)),this.setStartChildIndex(Vh(h,"startChildIndex",0)),this.setRTL(Vh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Uh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Nh.call(this)),this._childrenProportion}}Object.assign(Jh.prototype,Hh);var $h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},qh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Zh extends Jh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&($h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&($h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&$h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&$h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Zh.prototype,qh);var Kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Qh=Phaser.GameObjects.Graphics;class ta extends Qh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=Ve(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Ve(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&Kt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Kh.call(this,this.width,this.height,this.padding,t,e)),this}}const ea={rectangle:0,circle:1};var ia=function(t,e,i,s){var r=new ta(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Utils.Objects.GetValue;var na=/^[\x00-\x7F]+$/,ha=function(t){return na.test(t)},aa=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},la=2;const da={none:0,word:1,char:la,character:la,mix:3};var ca=function(t,e){switch(p(t)){case 0:switch("string"==typeof e&&(e=da[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=aa;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=da[e]||0),t.style.wrapMode=e}};const ua=Phaser.Renderer.WebGL.Utils;var pa={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ua.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const va=Phaser.Display.Color;var ga={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new va);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},fa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};X();const ma=Phaser.Display.Canvas.CanvasPool,ya=Phaser.GameObjects.GameObject,xa=Phaser.Utils.String.UUID;class Ca extends ya{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ma.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=xa(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ma.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ba=Phaser.GameObjects.Components;Phaser.Class.mixin(Ca,[ba.Alpha,ba.BlendMode,ba.Crop,ba.Depth,ba.Flip,ba.GetBounds,ba.Mask,ba.Origin,ba.Pipeline,ba.PostPipeline,ba.ScrollFactor,ba.Tint,ba.Transform,ba.Visible,pa,ga,fa]);var wa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:$s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Zt(this.data),this}};class Sa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Sa.prototype,wa);var Ta={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Pa=Phaser.Math.RotateAround;var Oa;const ka=Phaser.Geom.Rectangle;var _a,Ea=function(t){void 0===_a&&(_a=new ka);var e=t.drawTLX,i=t.drawTLY;return _a.setTo(e,i,t.drawTRX-e,t.drawBLY-i),_a};const La=Phaser.Math.RotateAround;var Ma,Ra=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ma&&(Ma={}),s=Ma),s.x=e,s.y=i,0!==t.rotation&&La(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Da=Phaser.GameObjects.Components.TransformMatrix;var Ia,za,Ya={},Xa=function(t,e,i,s,r){var n=Ra(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ya);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ia&&(Ia=new Da,za=new Da),t.parentContainer?t.getWorldTransformMatrix(Ia,za):Ia.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ia.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Aa=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Xa(t,e,n,h,r)},Wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Pa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ea(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Aa(this.parent,this,t,e,i)}};Object.assign(Wa,Ta);const Fa=Phaser.Math.DegToRad,Ba=Phaser.Math.RadToDeg,ja=Phaser.Utils.Objects.GetValue;class Ha extends Sa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ba(this._rotation)}set angle(t){this.rotation=Fa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ja(t,"width",void 0),i=ja(t,"height",void 0),s=ja(t,"scaleX",void 0),r=ja(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ha.prototype,Wa);const Na=Phaser.Utils.String.Pad;var Ua=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Na(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ga=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Va=Phaser.Utils.Objects.GetValue;class Ja{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Va(t,"x",0),i=Va(t,"y",0));var s=this.cornerRadius;s.tl=$a(Va(t,"tl",void 0),e,i),s.tr=$a(Va(t,"tr",void 0),e,i),s.bl=$a(Va(t,"bl",void 0),e,i),s.br=$a(Va(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){qa(this.cornerRadius.br,t)}}var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Za(t),t},qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Va(e,"x",0),t.y=Va(e,"y",0)),Za(t)},Za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ka=Phaser.Math.DegToRad;var Qa=function(t){return!t.hasOwnProperty("convex")||t.convex},to=function(t){return t.x>0&&t.y>0},eo=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,o,l,o,l,180,270,!1,h):eo(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,s-o,l,o,l,270,360,!1,h):eo(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,s-o,r-l,o,l,0,90,!1,h):eo(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,to(a)?(o=a.x*g,l=a.y*f,Qa(a)?eo(t,o,r-l,o,l,90,180,!1,h):eo(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const so=Phaser.Utils.Objects.GetValue;class ro extends Ha{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(so(e,"color",null),so(e,"color2",null),so(e,"horizontalGradient",!0)),this.setStroke(so(e,"stroke",null),so(e,"strokeThickness",2)),this.setCornerRadius(so(e,"cornerRadius",0),so(e,"cornerIteration",null))}set color(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ga("color2",t,this),Ga("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ga("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),io(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const no=Phaser.Utils.Objects.GetValue;class ho extends Ha{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(no(e,"color",null),no(e,"color2",null),no(e,"horizontalGradient",!0)),this.setStroke(no(e,"stroke",null),no(e,"strokeThickness",2))}set color(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ua(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,no(t,"color2",null),no(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,no(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const ao=Phaser.Utils.Objects.GetValue;class oo{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ao(t,"bold",!1)),this.setItalic(ao(t,"italic",!1)),this.setFontSize(ao(t,"fontSize","16px")),this.setFontFamily(ao(t,"fontFamily","Courier")),this.setColor(ao(t,"color","#fff")),this.setStrokeStyle(ao(t,"stroke",null),ao(t,"strokeThickness",0)),this.setShadow(ao(t,"shadowColor",null),ao(t,"shadowOffsetX",0),ao(t,"shadowOffsetY",0),ao(t,"shadowBlur",0)),this.setOffset(ao(t,"offsetX",0),ao(t,"offsetY",0)),this.setSpace(ao(t,"leftSpace",0),ao(t,"rightSpace",0)),this.setAlign(ao(t,"align",void 0)),this.setBackgroundColor(ao(t,"backgroundColor",null)),this.setBackgroundHeight(ao(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ao(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ga("stroke",t,this),Ga("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ga("shadowOffsetX",t,this),Ga("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new oo(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ua(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ua(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ua(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ua(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const lo=Phaser.Utils.Array.Remove,co=Phaser.Utils.Array.Remove,uo="text",po="image",vo="drawer",go="space",fo="command";var mo=function(t){return t.type===uo&&"\n"===t.text},yo=function(t){return t.type===uo&&"\f"===t.text},xo=function(t){return t.type===uo};class Co extends Ha{constructor(t,e,i){super(t,uo),this.updateTextFlag=!1,this.style=new oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var bo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const wo=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class So extends Ha{constructor(t,e,i){super(t,po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=wo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),wo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class To extends Ha{constructor(t,e,i,s){super(t,vo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Po extends Ha{constructor(t,e){super(t,go),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Oo extends Sa{constructor(t,e,i,s,r){super(t,fo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function ko(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>ko(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ko(t[i]));return e}var _o=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Eo={none:0,word:1,char:2,character:2,mix:3};var Lo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Io.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Io.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Yo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Yo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Yo(t,"wrapMode");void 0===c&&(c=Yo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Eo[c]);var u=Yo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Yo(t,"letterSpacing",0),v=Yo(t,"hAlign",0),g=Yo(t,"vAlign",0),f=Yo(t,"justifyPercentage",.25),m=_o({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,C=y.length;x0&&(E.push({children:L,width:M}),R=Math.max(R,M)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=R,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Wo(t,"maxLines",0);var a=0===i,o=Wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Wo(t,"letterSpacing",0),p=Wo(t,"rtl",!0),v=Wo(t,"hAlign",p?2:0),g=Wo(t,"vAlign",0),f=_o({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:L}),M=Math.max(M,L)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=M,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,A=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return di(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return li(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),lo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return co(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(uo);return null===i?i=new Co(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Aa(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const dl=Phaser.Utils.Objects.GetFastValue;var cl={};class ul{constructor(t){this.pools=dl(t,"pools",cl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new ll),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Cl(t,r,e,i,n),a=0;a<=ml&&0!==h;a++){if((r+=h)<0){r=0;break}h=Cl(t,r,e,i,n)}return a===ml&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),bl(t,e,i),t},xl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Cl=function(t,e,i,s,r){var n,h=xl(t,e,r),a=xl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},bl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const wl=Phaser.Utils.Objects.GetValue;var Sl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=wl(e,"minWidth",0),s=wl(e,"minHeight",0),r=wl(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return yl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),yl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Tl=Phaser.Utils.Objects.GetValue,Pl=[function(t){var e=this.scene,i=sa(t,"orientation",0);this.setOrientation(i);var s=sa(t,"icon",void 0),r=sa(t,"iconMask",void 0),n=sa(t,"innerBackground",void 0),h=sa(t,"title",void 0),a=sa(t,"separator",void 0),o=sa(t,"text",void 0),l=sa(t,"action",void 0),d=sa(t,"actionMask",void 0);if(s){var c=sa(t,"align.icon","center");m=0===this.orientation?{right:sa(t,"space.icon",0),top:sa(t,"space.iconTop",0),bottom:sa(t,"space.iconBottom",0),left:sa(t,"space.iconLeft",0)}:{bottom:sa(t,"space.icon",0),left:sa(t,"space.iconLeft",0),right:sa(t,"space.iconRight",0),top:sa(t,"space.iconTop",0)};var u=sa(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=ia.call(this,s,s,1)),!u){var p=sa(t,"iconSize",void 0);this.setIconSize(sa(t,"iconWidth",p),sa(t,"iconHeight",p))}}var v=new Jh(e,{orientation:1});n&&v.addBackground(n);var g=sa(t,"space.separator",0);if(h){c=sa(t,"align.title","left");var f=sa(t,"expandTitleWidth",!1);y=sa(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?sa(t,"space.title",g):0,left:sa(t,"space.titleLeft",0),right:sa(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:sa(t,"space.separatorLeft",0),right:sa(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=sa(t,"align.text","left");var y,x,C=sa(t,"expandTextWidth",!1);y=sa(t,"expandTextHeight",!1)?1:0,x=C,m={left:sa(t,"space.textLeft",0),right:sa(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:sa(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=sa(t,"align.action","center"),m=0===this.orientation?{top:sa(t,"space.actionTop",0),bottom:sa(t,"space.actionBottom",0),right:sa(t,"space.actionRight",0)}:{left:sa(t,"space.actionLeft",0),right:sa(t,"space.actionRight",0),bottom:sa(t,"space.actionBottom",0)},u=sa(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=ia.call(this,l,l,1)),!u)){var b=sa(t,"actionSize");this.setActionSize(sa(t,"actionWidth",b),sa(t,"actionHeight",b))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=ra(t,"title",void 0),s=ra(t,"separator",void 0),r=ra(t,"innerBackground",void 0),n=ra(t,"icon",void 0),h=ra(t,"iconMask",void 0),a=ra(t,"text",void 0),o=ra(t,"action",void 0),l=ra(t,"actionMask",void 0);if(i){var d=ra(t,"align.title","left"),c=ra(t,"expandTitleWidth",!1);y=ra(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:ra(t,"space.title",0),left:ra(t,"space.titleLeft",0),right:ra(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=ra(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:ra(t,"space.separatorLeft",0),right:ra(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=ra(t,"orientation",0),g=new Jh(e,{orientation:v,rtl:ra(t,"rtl",!1),space:{left:ra(t,"space.innerLeft",0),right:ra(t,"space.innerRight",0),top:ra(t,"space.innerTop",0),bottom:ra(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=ra(t,"align.icon","center"),p=0===g.orientation?{right:ra(t,"space.icon",0),top:ra(t,"space.iconTop",0),bottom:ra(t,"space.iconBottom",0),left:ra(t,"space.iconLeft",0)}:{bottom:ra(t,"space.icon",0),left:ra(t,"space.iconLeft",0),right:ra(t,"space.iconRight",0),top:ra(t,"space.iconTop",0)};var f=ra(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=ia.call(this,n,n,1)),!f){var m=ra(t,"iconSize",void 0);this.setIconSize(ra(t,"iconWidth",m),ra(t,"iconHeight",m))}}if(a){d=ra(t,"align.text","left");var y,x,C=ra(t,"space.text",0),b=ra(t,"expandTextWidth",!1),w=ra(t,"expandTextHeight",!1);0===g.orientation?(y=b?1:0,o&&(p={right:C}),x=w):(y=w?1:0,o&&(p={bottom:C}),x=b),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=ra(t,"align.action","center"),p=0===g.orientation?{top:ra(t,"space.actionTop",0),bottom:ra(t,"space.actionBottom",0),right:ra(t,"space.actionRight",0)}:{left:ra(t,"space.actionLeft",0),right:ra(t,"space.actionRight",0),bottom:ra(t,"space.actionBottom",0)},f=ra(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=ia.call(this,o,o,1)),!f)){var S=ra(t,"actionSize");this.setActionSize(ra(t,"actionWidth",S),ra(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];class Ol extends Zh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Tl(e,"background",void 0);i&&this.addBackground(i);var s=Tl(e,"title",void 0),r=Tl(e,"text",void 0);if(s){var n=Tl(e,"wrapTitle",!1),h=Tl(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),ca(s,n),e.expandTitleWidth=!0,fl(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Sl(s,{fitHeight:!0}))}if(r){var a=Tl(e,"wrapText",!1),o=Tl(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),ca(r,a),e.expandTextWidth=!0,fl(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Sl(r,{fitHeight:!0}))}var l=Tl(e,"layoutMode",0);(Pl[l]||Pl[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class kl extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=I(i,"expandTextWidth",!1),n=I(i,"expandTextHeight",!1);if(r||n){var h=p(s);switch(h){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,h=n?e:0;s.setFixedSize(i,h),i>0&&s.setWordWrapWidth(i)},1===h){var a=s.style;0===a.wrapMode&&(a.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(I(i,"typingMode","page")),this.page=new S(s,I(i,"page",void 0)),this.typing=new R(s,I(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=z[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Ol)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}return kl},"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(); diff --git a/dist/rextitlelabel.js b/dist/rextitlelabel.js index 21a9a8b5ff..9963de034f 100644 --- a/dist/rextitlelabel.js +++ b/dist/rextitlelabel.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$e(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$e(config, 'offsetX', 0); + offsetY = GetValue$e(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextitlelabel.min.js b/dist/rextitlelabel.min.js index 7dac5300f0..94df4a23fa 100644 --- a/dist/rextitlelabel.min.js +++ b/dist/rextitlelabel.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var B={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=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};const Pe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Ti extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return _i(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Xi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,ji),Hi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new _s(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Ls);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Fs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Vs=function(t,e){Ii(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const br=Phaser.Utils.Objects.GetValue;class Cr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=br(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Cr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},_r={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,bn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Sn,this.onDrag1End();break;case Pn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(Cn.prototype,Ne);var wn={};const Sn=0,Tn=1,Pn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var _n=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const Xn="IDLE",An="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),Wr.call(t,e),jr.call(t,e),In.call(t,e),jn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l){pe.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=nh[e];else if(ih(e)){var u;e=sh(u=e,"proportion",void 0),i=sh(u,"align",rh),s=sh(u,"padding",0),r=sh(u,"expand",!1),n=sh(u,"key",void 0),h=sh(u,"index",void 0),t.isRexSizer||(a=sh(u,"minWidth",void 0),o=sh(u,"minHeight",void 0)),l=sh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=_t.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,bh=Phaser.Utils.Objects.GetValue;class Ch extends Jn{constructor(t,e,i,s,r,n,h){xh(e)?(e=bh(h=e,"x",0),i=bh(h,"y",0),s=bh(h,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):xh(s)?(s=bh(h=s,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):xh(n)&&(n=bh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(bh(h,"space.item",0)),this.setStartChildIndex(bh(h,"startChildIndex",0)),this.setRTL(bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Th extends Ch{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Th.prototype,Sh);var Ph=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class kh extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=_h[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ph.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ph.call(this,this.width,this.height,this.padding,t,e)),this}}const _h={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new kh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Utils.Objects.GetValue,Dh=Phaser.GameObjects.Text;var Lh=function(t){return t instanceof Dh};const zh=Phaser.GameObjects.BitmapText;var Yh=function(t){return t instanceof zh},Xh=/^[\x00-\x7F]+$/,Ah=function(t){return Xh.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Ih=2;const Bh={none:0,word:1,char:Ih,character:Ih,mix:3};var jh=function(t,e){var i=function(t){return Yh(t)?2:Lh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e}};const Hh=Phaser.Renderer.WebGL.Utils;var Nh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Hh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Uh=Phaser.Display.Color;var Gh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Uh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Vh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const $h=Phaser.Display.Canvas.CanvasPool,Jh=Phaser.GameObjects.GameObject,qh=Phaser.Utils.String.UUID;class Zh extends Jh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=$h.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=qh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){$h.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Kh=Phaser.GameObjects.Components;Phaser.Class.mixin(Zh,[Kh.Alpha,Kh.BlendMode,Kh.Crop,Kh.Depth,Kh.Flip,Kh.GetBounds,Kh.Mask,Kh.Origin,Kh.Pipeline,Kh.PostPipeline,Kh.ScrollFactor,Kh.Tint,Kh.Transform,Kh.Visible,Nh,Gh,Vh]);var Qh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class ta{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ta.prototype,Qh);var ea={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ia=Phaser.Math.RotateAround;var sa;const ra=Phaser.Geom.Rectangle;var na,ha=function(t){void 0===na&&(na=new ra);var e=t.drawTLX,i=t.drawTLY;return na.setTo(e,i,t.drawTRX-e,t.drawBLY-i),na};const aa=Phaser.Math.RotateAround;var oa,la=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===oa&&(oa={}),s=oa),s.x=e,s.y=i,0!==t.rotation&&aa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const da=Phaser.GameObjects.Components.TransformMatrix;var ca,ua,pa={},va=function(t,e,i,s,r){var n=la(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ca&&(ca=new da,ua=new da),t.parentContainer?t.getWorldTransformMatrix(ca,ua):ca.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ca.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ga=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return va(t,e,n,h,r)},fa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===sa&&(sa={}),s=sa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ia(s,0,0,-i.rotation),s}(t,e,this,!0);return ha(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ga(this.parent,this,t,e,i)}};Object.assign(fa,ea);const ma=Phaser.Math.DegToRad,ya=Phaser.Math.RadToDeg,xa=Phaser.Utils.Objects.GetValue;class ba extends ta{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ya(this._rotation)}set angle(t){this.rotation=ma(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=xa(t,"width",void 0),i=xa(t,"height",void 0),s=xa(t,"scaleX",void 0),r=xa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ba.prototype,fa);const Ca=Phaser.Utils.String.Pad;var wa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ca(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Sa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ta=Phaser.Utils.Objects.GetValue;class Pa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ta(t,"x",0),i=Ta(t,"y",0));var s=this.cornerRadius;s.tl=Oa(Ta(t,"tl",void 0),e,i),s.tr=Oa(Ta(t,"tr",void 0),e,i),s.bl=Oa(Ta(t,"bl",void 0),e,i),s.br=Oa(Ta(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ka(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ka(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ka(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ka(this.cornerRadius.br,t)}}var Oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_a(t),t},ka=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ta(e,"x",0),t.y=Ta(e,"y",0)),_a(t)},_a=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ea=Phaser.Math.DegToRad;var Ma=function(t){return!t.hasOwnProperty("convex")||t.convex},Ra=function(t){return t.x>0&&t.y>0},Da=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,o,l,o,l,180,270,!1,h):Da(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,s-o,l,o,l,270,360,!1,h):Da(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,s-o,r-l,o,l,0,90,!1,h):Da(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,o,r-l,o,l,90,180,!1,h):Da(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Ya extends ba{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=wa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Sa("color2",t,this),Sa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Sa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),La(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Xa=Phaser.Utils.Objects.GetValue;class Aa extends ba{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2))}set color(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=wa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Xa(t,"color2",null),Xa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class Fa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Sa("stroke",t,this),Sa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Sa("shadowOffsetX",t,this),Sa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Fa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=wa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=wa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=wa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=wa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ia=Phaser.Utils.Array.Remove,Ba=Phaser.Utils.Array.Remove,ja="text",Ha="image",Na="drawer",Ua="space",Ga="command";var Va=function(t){return t.type===ja&&"\n"===t.text},$a=function(t){return t.type===ja&&"\f"===t.text},Ja=function(t){return t.type===ja};class qa extends ba{constructor(t,e,i){super(t,ja),this.updateTextFlag=!1,this.style=new Fa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Za=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ka=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Qa extends ba{constructor(t,e,i){super(t,Ha),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Ka.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Ka.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class to extends ba{constructor(t,e,i,s){super(t,Na),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class eo extends ba{constructor(t,e){super(t,Ua),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class io extends ta{constructor(t,e,i,s,r){super(t,Ga),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function so(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>so(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=so(t[i]));return e}var ro=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const no={none:0,word:1,char:2,character:2,mix:3};var ho=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=po(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=po(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=po(t,"wrapMode");void 0===c&&(c=po(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=no[c]);var u=po(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=po(t,"letterSpacing",0),v=po(t,"hAlign",0),g=po(t,"vAlign",0),f=po(t,"justifyPercentage",.25),m=ro({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=fo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=fo(t,"maxLines",0);var a=0===i,o=fo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=fo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=fo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=fo(t,"letterSpacing",0),p=fo(t,"rtl",!0),v=fo(t,"hAlign",p?2:0),g=fo(t,"vAlign",0),f=ro({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return _e(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ja);return null===i?i=new qa(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ga(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Bo=Phaser.Utils.Objects.GetFastValue;var jo={};class Ho{constructor(t){this.pools=Bo(t,"pools",jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Io),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Zo(t,r,e,i,n),a=0;a<=$o&&0!==h;a++){if((r+=h)<0){r=0;break}h=Zo(t,r,e,i,n)}return a===$o&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ko(t,e,i),t},qo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Zo=function(t,e,i,s,r){var n,h=qo(t,e,r),a=qo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Ko=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Qo=Phaser.Utils.Objects.GetValue;var tl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Qo(e,"minWidth",0),s=Qo(e,"minHeight",0),r=Qo(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Jo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Jo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const el=Phaser.Utils.Objects.GetValue,il=[function(t){var e=this.scene,i=Mh(t,"orientation",0);this.setOrientation(i);var s=Mh(t,"icon",void 0),r=Mh(t,"iconMask",void 0),n=Mh(t,"innerBackground",void 0),h=Mh(t,"title",void 0),a=Mh(t,"separator",void 0),o=Mh(t,"text",void 0),l=Mh(t,"action",void 0),d=Mh(t,"actionMask",void 0);if(s){var c=Mh(t,"align.icon","center");m=0===this.orientation?{right:Mh(t,"space.icon",0),top:Mh(t,"space.iconTop",0),bottom:Mh(t,"space.iconBottom",0),left:Mh(t,"space.iconLeft",0)}:{bottom:Mh(t,"space.icon",0),left:Mh(t,"space.iconLeft",0),right:Mh(t,"space.iconRight",0),top:Mh(t,"space.iconTop",0)};var u=Mh(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=Eh.call(this,s,s,1)),!u){var p=Mh(t,"iconSize",void 0);this.setIconSize(Mh(t,"iconWidth",p),Mh(t,"iconHeight",p))}}var v=new Ch(e,{orientation:1});n&&v.addBackground(n);var g=Mh(t,"space.separator",0);if(h){c=Mh(t,"align.title","left");var f=Mh(t,"expandTitleWidth",!1);y=Mh(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?Mh(t,"space.title",g):0,left:Mh(t,"space.titleLeft",0),right:Mh(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:Mh(t,"space.separatorLeft",0),right:Mh(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=Mh(t,"align.text","left");var y,x,b=Mh(t,"expandTextWidth",!1);y=Mh(t,"expandTextHeight",!1)?1:0,x=b,m={left:Mh(t,"space.textLeft",0),right:Mh(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:Mh(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=Mh(t,"align.action","center"),m=0===this.orientation?{top:Mh(t,"space.actionTop",0),bottom:Mh(t,"space.actionBottom",0),right:Mh(t,"space.actionRight",0)}:{left:Mh(t,"space.actionLeft",0),right:Mh(t,"space.actionRight",0),bottom:Mh(t,"space.actionBottom",0)},u=Mh(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=Eh.call(this,l,l,1)),!u)){var C=Mh(t,"actionSize");this.setActionSize(Mh(t,"actionWidth",C),Mh(t,"actionHeight",C))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Rh(t,"title",void 0),s=Rh(t,"separator",void 0),r=Rh(t,"innerBackground",void 0),n=Rh(t,"icon",void 0),h=Rh(t,"iconMask",void 0),a=Rh(t,"text",void 0),o=Rh(t,"action",void 0),l=Rh(t,"actionMask",void 0);if(i){var d=Rh(t,"align.title","left"),c=Rh(t,"expandTitleWidth",!1);y=Rh(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:Rh(t,"space.title",0),left:Rh(t,"space.titleLeft",0),right:Rh(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=Rh(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:Rh(t,"space.separatorLeft",0),right:Rh(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=Rh(t,"orientation",0),g=new Ch(e,{orientation:v,rtl:Rh(t,"rtl",!1),space:{left:Rh(t,"space.innerLeft",0),right:Rh(t,"space.innerRight",0),top:Rh(t,"space.innerTop",0),bottom:Rh(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=Rh(t,"align.icon","center"),p=0===g.orientation?{right:Rh(t,"space.icon",0),top:Rh(t,"space.iconTop",0),bottom:Rh(t,"space.iconBottom",0),left:Rh(t,"space.iconLeft",0)}:{bottom:Rh(t,"space.icon",0),left:Rh(t,"space.iconLeft",0),right:Rh(t,"space.iconRight",0),top:Rh(t,"space.iconTop",0)};var f=Rh(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=Eh.call(this,n,n,1)),!f){var m=Rh(t,"iconSize",void 0);this.setIconSize(Rh(t,"iconWidth",m),Rh(t,"iconHeight",m))}}if(a){d=Rh(t,"align.text","left");var y,x,b=Rh(t,"space.text",0),C=Rh(t,"expandTextWidth",!1),w=Rh(t,"expandTextHeight",!1);0===g.orientation?(y=C?1:0,o&&(p={right:b}),x=w):(y=w?1:0,o&&(p={bottom:b}),x=C),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=Rh(t,"align.action","center"),p=0===g.orientation?{top:Rh(t,"space.actionTop",0),bottom:Rh(t,"space.actionBottom",0),right:Rh(t,"space.actionRight",0)}:{left:Rh(t,"space.actionLeft",0),right:Rh(t,"space.actionRight",0),bottom:Rh(t,"space.actionBottom",0)},f=Rh(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=Eh.call(this,o,o,1)),!f)){var S=Rh(t,"actionSize");this.setActionSize(Rh(t,"actionWidth",S),Rh(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];return class extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=el(e,"background",void 0);i&&this.addBackground(i);var s=el(e,"title",void 0),r=el(e,"text",void 0);if(s){var n=el(e,"wrapTitle",!1),h=el(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),jh(s,n),e.expandTitleWidth=!0,Vo(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,tl(s,{fitHeight:!0}))}if(r){var a=el(e,"wrapText",!1),o=el(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),jh(r,a),e.expandTextWidth=!0,Vo(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,tl(r,{fitHeight:!0}))}var l=el(e,"layoutMode",0);(il[l]||il[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextitlelabel=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var B={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=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};const Pe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class bi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Ti extends bi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return _i(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Xi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,ji),Hi.onInitFade=function(){ji.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends bi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={stop:0,destroy:1,yoyo:2};var Ji=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends bi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new _s(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Ls);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var js={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Fs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Vs=function(t,e){Ii(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let qs=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Js(i,"transitIn",Gs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Js(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&$s(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?$s(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&$s(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const gr={press:0,pointerdown:0,release:1,pointerup:1};var fr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const br=Phaser.Utils.Objects.GetValue;class Cr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=br(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=wr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?mr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Cr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Pr=Phaser.Utils.Objects.GetValue;class Or extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(Pr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},_r={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Er=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ur,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Ur=0,Gr=1,Vr="IDLE",$r=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class qr extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Kr;break;case Kr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Kr);break;case Qr:this.state=Kr}}onDragEnd(){this.state===Kr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Zr)}get isTapped(){return this.state===Qr}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Kr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,an=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const cn=Phaser.Utils.Objects.GetValue,un=Phaser.Math.RadToDeg;class pn extends Nr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=vn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(cn(t,"threshold",10)),this.setVelocityThreshold(cn(t,"velocityThreshold",1e3)),this.setDirectionMode(cn(t,"dir","8dir")),this}onDragStart(){this.state=gn}onDragEnd(){this.state=vn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=fn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===fn&&(this.state=vn)}get isSwiped(){return this.state===fn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(un(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(pn.prototype,on);const vn="IDLE",gn="BEGIN",fn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,bn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Sn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Sn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=Pn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],yn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Sn,this.onDrag1End();break;case Pn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case Pn:this.onDrag2()}}}dragCancel(){return this.tracerState===Pn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0],e=this.pointers[1];return bn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Pn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Pn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(Cn.prototype,Ne);var wn={};const Sn=0,Tn=1,Pn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var _n=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},En={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Dn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=En),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rn(Ln(this.angleBetween));this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Rn(Ln(this.angleBetween)),this.angle=Dn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const Xn="IDLE",An="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),Wr.call(t,e),jr.call(t,e),In.call(t,e),jn.call(t,e),Nn.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ih=Phaser.Utils.Objects.IsPlainObject,sh=Phaser.Utils.Objects.GetValue,rh=Phaser.Display.Align.CENTER,nh={min:0,full:-1};var hh=function(t,e,i,s,r,n,h,a,o,l,d,c){pe.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=nh[e];else if(ih(e)){var v;e=sh(v=e,"proportion",void 0),i=sh(v,"align",rh),s=sh(v,"padding",0),r=sh(v,"expand",!1),n=sh(v,"key",void 0),h=sh(v,"index",void 0),t.isRexSizer||(a=sh(v,"minWidth",void 0),o=sh(v,"minHeight",void 0)),l=sh(v,"fitRatio",0),d=sh(v,"offsetX",0),c=sh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=rh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ah={add:hh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),hh.call(this,new th(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ih(i)&&(i.index=t),hh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=eh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const oh=_t.prototype.clear;var lh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,lh.call(this,t),this}},uh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},ph={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},vh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},gh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},fh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kn.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(fh,ah,ch,uh,ph,vh,gh);var mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},yh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,bh=Phaser.Utils.Objects.GetValue;class Ch extends Jn{constructor(t,e,i,s,r,n,h){xh(e)?(e=bh(h=e,"x",0),i=bh(h,"y",0),s=bh(h,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):xh(s)?(s=bh(h=s,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):xh(n)&&(n=bh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(bh(h,"space.item",0)),this.setStartChildIndex(bh(h,"startChildIndex",0)),this.setRTL(bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=yh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=mh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,fh);var wh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Sh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Th extends Ch{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(wh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(wh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&wh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&wh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Th.prototype,Sh);var Ph=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const Oh=Phaser.GameObjects.Graphics;class kh extends Oh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=_h[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ph.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ph.call(this,this.width,this.height,this.padding,t,e)),this}}const _h={rectangle:0,circle:1};var Eh=function(t,e,i,s){var r=new kh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Mh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Utils.Objects.GetValue,Dh=Phaser.GameObjects.Text;var Lh=function(t){return t instanceof Dh};const zh=Phaser.GameObjects.BitmapText;var Yh=function(t){return t instanceof zh},Xh=/^[\x00-\x7F]+$/,Ah=function(t){return Xh.test(t)},Wh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Ih=2;const Bh={none:0,word:1,char:Ih,character:Ih,mix:3};var jh=function(t,e){var i=function(t){return Yh(t)?2:Lh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Bh[e]||0),t.style.wrapMode=e}};const Hh=Phaser.Renderer.WebGL.Utils;var Nh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Hh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Uh=Phaser.Display.Color;var Gh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Uh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Vh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const $h=Phaser.Display.Canvas.CanvasPool,Jh=Phaser.GameObjects.GameObject,qh=Phaser.Utils.String.UUID;class Zh extends Jh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=$h.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=qh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){$h.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Kh=Phaser.GameObjects.Components;Phaser.Class.mixin(Zh,[Kh.Alpha,Kh.BlendMode,Kh.Crop,Kh.Depth,Kh.Flip,Kh.GetBounds,Kh.Mask,Kh.Origin,Kh.Pipeline,Kh.PostPipeline,Kh.ScrollFactor,Kh.Tint,Kh.Transform,Kh.Visible,Nh,Gh,Vh]);var Qh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class ta{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(ta.prototype,Qh);var ea={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ia=Phaser.Math.RotateAround;var sa;const ra=Phaser.Geom.Rectangle;var na,ha=function(t){void 0===na&&(na=new ra);var e=t.drawTLX,i=t.drawTLY;return na.setTo(e,i,t.drawTRX-e,t.drawBLY-i),na};const aa=Phaser.Math.RotateAround;var oa,la=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===oa&&(oa={}),s=oa),s.x=e,s.y=i,0!==t.rotation&&aa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const da=Phaser.GameObjects.Components.TransformMatrix;var ca,ua,pa={},va=function(t,e,i,s,r){var n=la(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=pa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ca&&(ca=new da,ua=new da),t.parentContainer?t.getWorldTransformMatrix(ca,ua):ca.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ca.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},ga=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return va(t,e,n,h,r)},fa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===sa&&(sa={}),s=sa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ia(s,0,0,-i.rotation),s}(t,e,this,!0);return ha(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ga(this.parent,this,t,e,i)}};Object.assign(fa,ea);const ma=Phaser.Math.DegToRad,ya=Phaser.Math.RadToDeg,xa=Phaser.Utils.Objects.GetValue;class ba extends ta{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ya(this._rotation)}set angle(t){this.rotation=ma(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=xa(t,"width",void 0),i=xa(t,"height",void 0),s=xa(t,"scaleX",void 0),r=xa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ba.prototype,fa);const Ca=Phaser.Utils.String.Pad;var wa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ca(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Sa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ta=Phaser.Utils.Objects.GetValue;class Pa{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ta(t,"x",0),i=Ta(t,"y",0));var s=this.cornerRadius;s.tl=Oa(Ta(t,"tl",void 0),e,i),s.tr=Oa(Ta(t,"tr",void 0),e,i),s.bl=Oa(Ta(t,"bl",void 0),e,i),s.br=Oa(Ta(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ka(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ka(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ka(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ka(this.cornerRadius.br,t)}}var Oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_a(t),t},ka=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ta(e,"x",0),t.y=Ta(e,"y",0)),_a(t)},_a=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ea=Phaser.Math.DegToRad;var Ma=function(t){return!t.hasOwnProperty("convex")||t.convex},Ra=function(t){return t.x>0&&t.y>0},Da=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,o,l,o,l,180,270,!1,h):Da(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,s-o,l,o,l,270,360,!1,h):Da(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,s-o,r-l,o,l,0,90,!1,h):Da(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ra(a)?(o=a.x*g,l=a.y*f,Ma(a)?Da(t,o,r-l,o,l,90,180,!1,h):Da(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const za=Phaser.Utils.Objects.GetValue;class Ya extends ba{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2)),this.setCornerRadius(za(e,"cornerRadius",0),za(e,"cornerIteration",null))}set color(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=wa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Sa("color2",t,this),Sa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Sa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),La(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Xa=Phaser.Utils.Objects.GetValue;class Aa extends ba{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2))}set color(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=wa(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=wa(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Xa(t,"color2",null),Xa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Wa=Phaser.Utils.Objects.GetValue;class Fa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Wa(t,"bold",!1)),this.setItalic(Wa(t,"italic",!1)),this.setFontSize(Wa(t,"fontSize","16px")),this.setFontFamily(Wa(t,"fontFamily","Courier")),this.setColor(Wa(t,"color","#fff")),this.setStrokeStyle(Wa(t,"stroke",null),Wa(t,"strokeThickness",0)),this.setShadow(Wa(t,"shadowColor",null),Wa(t,"shadowOffsetX",0),Wa(t,"shadowOffsetY",0),Wa(t,"shadowBlur",0)),this.setOffset(Wa(t,"offsetX",0),Wa(t,"offsetY",0)),this.setSpace(Wa(t,"leftSpace",0),Wa(t,"rightSpace",0)),this.setAlign(Wa(t,"align",void 0)),this.setBackgroundColor(Wa(t,"backgroundColor",null)),this.setBackgroundHeight(Wa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Wa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Sa("stroke",t,this),Sa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Sa("shadowOffsetX",t,this),Sa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Fa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=wa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=wa(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=wa(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=wa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ia=Phaser.Utils.Array.Remove,Ba=Phaser.Utils.Array.Remove,ja="text",Ha="image",Na="drawer",Ua="space",Ga="command";var Va=function(t){return t.type===ja&&"\n"===t.text},$a=function(t){return t.type===ja&&"\f"===t.text},Ja=function(t){return t.type===ja};class qa extends ba{constructor(t,e,i){super(t,ja),this.updateTextFlag=!1,this.style=new Fa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Za=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ka=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Qa extends ba{constructor(t,e,i){super(t,Ha),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Ka.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Ka.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class to extends ba{constructor(t,e,i,s){super(t,Na),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class eo extends ba{constructor(t,e){super(t,Ua),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class io extends ta{constructor(t,e,i,s,r){super(t,Ga),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function so(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>so(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=so(t[i]));return e}var ro=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const no={none:0,word:1,char:2,character:2,mix:3};var ho=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=po(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=po(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=po(t,"wrapMode");void 0===c&&(c=po(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=no[c]);var u=po(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=po(t,"letterSpacing",0),v=po(t,"hAlign",0),g=po(t,"vAlign",0),f=po(t,"justifyPercentage",.25),m=ro({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=fo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=fo(t,"maxLines",0);var a=0===i,o=fo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=fo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=fo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=fo(t,"letterSpacing",0),p=fo(t,"rtl",!0),v=fo(t,"hAlign",p?2:0),g=fo(t,"vAlign",0),f=ro({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return _e(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ba(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ja);return null===i?i=new qa(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ga(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Bo=Phaser.Utils.Objects.GetFastValue;var jo={};class Ho{constructor(t){this.pools=Bo(t,"pools",jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Io),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Zo(t,r,e,i,n),a=0;a<=$o&&0!==h;a++){if((r+=h)<0){r=0;break}h=Zo(t,r,e,i,n)}return a===$o&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ko(t,e,i),t},qo=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Zo=function(t,e,i,s,r){var n,h=qo(t,e,r),a=qo(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Ko=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Qo=Phaser.Utils.Objects.GetValue;var tl=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Qo(e,"minWidth",0),s=Qo(e,"minHeight",0),r=Qo(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Jo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Jo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const el=Phaser.Utils.Objects.GetValue,il=[function(t){var e=this.scene,i=Mh(t,"orientation",0);this.setOrientation(i);var s=Mh(t,"icon",void 0),r=Mh(t,"iconMask",void 0),n=Mh(t,"innerBackground",void 0),h=Mh(t,"title",void 0),a=Mh(t,"separator",void 0),o=Mh(t,"text",void 0),l=Mh(t,"action",void 0),d=Mh(t,"actionMask",void 0);if(s){var c=Mh(t,"align.icon","center");m=0===this.orientation?{right:Mh(t,"space.icon",0),top:Mh(t,"space.iconTop",0),bottom:Mh(t,"space.iconBottom",0),left:Mh(t,"space.iconLeft",0)}:{bottom:Mh(t,"space.icon",0),left:Mh(t,"space.iconLeft",0),right:Mh(t,"space.iconRight",0),top:Mh(t,"space.iconTop",0)};var u=Mh(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:u}),r&&(r=Eh.call(this,s,s,1)),!u){var p=Mh(t,"iconSize",void 0);this.setIconSize(Mh(t,"iconWidth",p),Mh(t,"iconHeight",p))}}var v=new Ch(e,{orientation:1});n&&v.addBackground(n);var g=Mh(t,"space.separator",0);if(h){c=Mh(t,"align.title","left");var f=Mh(t,"expandTitleWidth",!1);y=Mh(t,"expandTitleHeight",!1)?1:0,x=f,m={bottom:!a&&o?Mh(t,"space.title",g):0,left:Mh(t,"space.titleLeft",0),right:Mh(t,"space.titleRight",0)},v.add(h,{proportion:y,expand:x,align:c,padding:m})}if(a){var m={top:h?g:0,bottom:o?g:0,left:Mh(t,"space.separatorLeft",0),right:Mh(t,"space.separatorRight",0)};v.add(a,{expand:!0,padding:m})}if(o){c=Mh(t,"align.text","left");var y,x,b=Mh(t,"expandTextWidth",!1);y=Mh(t,"expandTextHeight",!1)?1:0,x=b,m={left:Mh(t,"space.textLeft",0),right:Mh(t,"space.textRight",0)},v.add(o,{proportion:y,expand:x,align:c,padding:m})}if(m=void 0,l&&(m={right:Mh(t,"space.text",0)}),this.add(v,{proportion:1,padding:m}),l&&(c=Mh(t,"align.action","center"),m=0===this.orientation?{top:Mh(t,"space.actionTop",0),bottom:Mh(t,"space.actionBottom",0),right:Mh(t,"space.actionRight",0)}:{left:Mh(t,"space.actionLeft",0),right:Mh(t,"space.actionRight",0),bottom:Mh(t,"space.actionBottom",0)},u=Mh(t,"squareFitAction",!1)?1:0,this.add(l,{proportion:0,align:c,padding:m,fitRatio:u}),d&&(d=Eh.call(this,l,l,1)),!u)){var C=Mh(t,"actionSize");this.setActionSize(Mh(t,"actionWidth",C),Mh(t,"actionHeight",C))}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",v),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",h),this.addChildrenMap("separator",a),this.addChildrenMap("text",o),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",d)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Rh(t,"title",void 0),s=Rh(t,"separator",void 0),r=Rh(t,"innerBackground",void 0),n=Rh(t,"icon",void 0),h=Rh(t,"iconMask",void 0),a=Rh(t,"text",void 0),o=Rh(t,"action",void 0),l=Rh(t,"actionMask",void 0);if(i){var d=Rh(t,"align.title","left"),c=Rh(t,"expandTitleWidth",!1);y=Rh(t,"expandTitleHeight",!1)?1:0,x=c,p={bottom:Rh(t,"space.title",0),left:Rh(t,"space.titleLeft",0),right:Rh(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:x,align:d,padding:p})}if(s){var u=Rh(t,"space.separator",0),p={top:i?u:0,bottom:a?u:0,left:Rh(t,"space.separatorLeft",0),right:Rh(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var v=Rh(t,"orientation",0),g=new Ch(e,{orientation:v,rtl:Rh(t,"rtl",!1),space:{left:Rh(t,"space.innerLeft",0),right:Rh(t,"space.innerRight",0),top:Rh(t,"space.innerTop",0),bottom:Rh(t,"space.innerBottom",0)}});if(r&&g.addBackground(r),this.add(g,{proportion:1,expand:!0}),n){d=Rh(t,"align.icon","center"),p=0===g.orientation?{right:Rh(t,"space.icon",0),top:Rh(t,"space.iconTop",0),bottom:Rh(t,"space.iconBottom",0),left:Rh(t,"space.iconLeft",0)}:{bottom:Rh(t,"space.icon",0),left:Rh(t,"space.iconLeft",0),right:Rh(t,"space.iconRight",0),top:Rh(t,"space.iconTop",0)};var f=Rh(t,"squareFitIcon",!1)?1:0;if(g.add(n,{proportion:0,align:d,padding:p,fitRatio:f}),h&&(h=Eh.call(this,n,n,1)),!f){var m=Rh(t,"iconSize",void 0);this.setIconSize(Rh(t,"iconWidth",m),Rh(t,"iconHeight",m))}}if(a){d=Rh(t,"align.text","left");var y,x,b=Rh(t,"space.text",0),C=Rh(t,"expandTextWidth",!1),w=Rh(t,"expandTextHeight",!1);0===g.orientation?(y=C?1:0,o&&(p={right:b}),x=w):(y=w?1:0,o&&(p={bottom:b}),x=C),g.add(a,{proportion:y,expand:x,align:d,padding:p})}if(o&&(d=Rh(t,"align.action","center"),p=0===g.orientation?{top:Rh(t,"space.actionTop",0),bottom:Rh(t,"space.actionBottom",0),right:Rh(t,"space.actionRight",0)}:{left:Rh(t,"space.actionLeft",0),right:Rh(t,"space.actionRight",0),bottom:Rh(t,"space.actionBottom",0)},f=Rh(t,"squareFitAction",!1)?1:0,g.add(o,{proportion:0,align:d,padding:p,fitRatio:f}),l&&(l=Eh.call(this,o,o,1)),!f)){var S=Rh(t,"actionSize");this.setActionSize(Rh(t,"actionWidth",S),Rh(t,"actionHeight",S))}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",h),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",l)}];return class extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=el(e,"background",void 0);i&&this.addBackground(i);var s=el(e,"title",void 0),r=el(e,"text",void 0);if(s){var n=el(e,"wrapTitle",!1),h=el(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),jh(s,n),e.expandTitleWidth=!0,Vo(s)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,tl(s,{fitHeight:!0}))}if(r){var a=el(e,"wrapText",!1),o=el(e,"adjustTextFontSize",!1);a?(!0===a&&(a="word"),jh(r,a),e.expandTextWidth=!0,Vo(r)):o&&(e.expandTextWidth=!0,e.expandTextHeight=!0,tl(r,{fitHeight:!0}))}var l=el(e,"layoutMode",0);(il[l]||il[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextitlelabel=e(); diff --git a/dist/rextoast.js b/dist/rextoast.js index 410bbcf0ce..b3963968e7 100644 --- a/dist/rextoast.js +++ b/dist/rextoast.js @@ -12192,7 +12192,7 @@ var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$f(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$f(config, 'offsetX', 0); + offsetY = GetValue$f(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextoast.min.js b/dist/rextoast.min.js index 800c1a1556..6c65f4fef8 100644 --- a/dist/rextoast.min.js +++ b/dist/rextoast.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},z=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=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};const Pe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Ti extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return _i(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Wi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=$i(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=$i(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new _s(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,Ls);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?Xs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Is extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Wi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Vs=function(t,e){Wi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Vs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),h=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class kr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Vr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Vr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Zr extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Kr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const un=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=gn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=gn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=gn)}get isSwiped(){return this.state===mn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const gn="IDLE",fn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=On,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1End();break;case On:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(wn.prototype,Ne);var Sn={};const Tn=0,Pn=1,On=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var En=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},Mn={};const Rn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Dn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const An="IDLE",Fn="BEGIN",In="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Lr.call(t,e),Xr.call(t,e),Ir.call(t,e),Hr.call(t,e),jn.call(t,e),Hn.call(t,e),Un.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const sh=Phaser.Utils.Objects.IsPlainObject,rh=Phaser.Utils.Objects.GetValue,nh=Phaser.Display.Align.CENTER,hh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,a,o,l){pe.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=hh[e];else if(sh(e)){var u;e=rh(u=e,"proportion",void 0),i=rh(u,"align",nh),s=rh(u,"padding",0),r=rh(u,"expand",!1),n=rh(u,"key",void 0),h=rh(u,"index",void 0),t.isRexSizer||(a=rh(u,"minWidth",void 0),o=rh(u,"minHeight",void 0)),l=rh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=nh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ce(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},oh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new eh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return sh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ih.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const lh=_t.prototype.clear;var dh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),lh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,dh.call(this,t),this}},ph={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},vh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},gh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},mh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(We(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(mh,oh,uh,ph,vh,gh,fh);var yh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class wh extends qn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):xh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):xh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=yh.call(this)),this._childrenProportion}}Object.assign(wh.prototype,mh);var Sh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Th={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends wh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Sh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Sh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Sh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Sh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Th);var Oh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const kh=Phaser.GameObjects.Graphics;class _h extends kh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Eh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Oh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Oh.call(this,this.width,this.height,this.padding,t,e)),this}}const Eh={rectangle:0,circle:1};var Mh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Rh=Phaser.GameObjects.Text;var Dh=function(t){return t instanceof Rh};const Lh=Phaser.GameObjects.BitmapText;var Yh=function(t){return t instanceof Lh},zh=/^[\x00-\x7F]+$/,Xh=function(t){return zh.test(t)},Ah=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Ih=2;const Wh={none:0,word:1,char:Ih,character:Ih,mix:3};var jh=function(t,e){var i=function(t){return Yh(t)?2:Dh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ah;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e}};const Bh=Phaser.Renderer.WebGL.Utils;var Hh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Bh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Nh=Phaser.Display.Color;var Uh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Nh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Gh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Vh=Phaser.Display.Canvas.CanvasPool,Jh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class qh extends Jh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Vh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Vh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Zh=Phaser.GameObjects.Components;Phaser.Class.mixin(qh,[Zh.Alpha,Zh.BlendMode,Zh.Crop,Zh.Depth,Zh.Flip,Zh.GetBounds,Zh.Mask,Zh.Origin,Zh.Pipeline,Zh.PostPipeline,Zh.ScrollFactor,Zh.Tint,Zh.Transform,Zh.Visible,Hh,Uh,Gh]);var Kh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Qh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Qh.prototype,Kh);var ta={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ea=Phaser.Math.RotateAround;var ia;const sa=Phaser.Geom.Rectangle;var ra,na=function(t){void 0===ra&&(ra=new sa);var e=t.drawTLX,i=t.drawTLY;return ra.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ra};const ha=Phaser.Math.RotateAround;var aa,oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===aa&&(aa={}),s=aa),s.x=e,s.y=i,0!==t.rotation&&ha(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const la=Phaser.GameObjects.Components.TransformMatrix;var da,ca,ua={},pa=function(t,e,i,s,r){var n=oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ua);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===da&&(da=new la,ca=new la),t.parentContainer?t.getWorldTransformMatrix(da,ca):da.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),da.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},va=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return pa(t,e,n,h,r)},ga={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ia&&(ia={}),s=ia),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ea(s,0,0,-i.rotation),s}(t,e,this,!0);return na(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return va(this.parent,this,t,e,i)}};Object.assign(ga,ta);const fa=Phaser.Math.DegToRad,ma=Phaser.Math.RadToDeg,ya=Phaser.Utils.Objects.GetValue;class ba extends Qh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ma(this._rotation)}set angle(t){this.rotation=fa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ya(t,"width",void 0),i=ya(t,"height",void 0),s=ya(t,"scaleX",void 0),r=ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ba.prototype,ga);const xa=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${xa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Sa=Phaser.Utils.Objects.GetValue;class Ta{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Sa(t,"x",0),i=Sa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(Sa(t,"tl",void 0),e,i),s.tr=Pa(Sa(t,"tr",void 0),e,i),s.bl=Pa(Sa(t,"bl",void 0),e,i),s.br=Pa(Sa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Oa(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ka(t),t},Oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Sa(e,"x",0),t.y=Sa(e,"y",0)),ka(t)},ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var Ea=function(t){return!t.hasOwnProperty("convex")||t.convex},Ma=function(t){return t.x>0&&t.y>0},Ra=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,o,l,o,l,180,270,!1,h):Ra(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,s-o,l,o,l,270,360,!1,h):Ra(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,s-o,r-l,o,l,0,90,!1,h):Ra(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,o,r-l,o,l,90,180,!1,h):Ra(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const La=Phaser.Utils.Objects.GetValue;class Ya extends ba{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(La(e,"color",null),La(e,"color2",null),La(e,"horizontalGradient",!0)),this.setStroke(La(e,"stroke",null),La(e,"strokeThickness",2)),this.setCornerRadius(La(e,"cornerRadius",0),La(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,wa("color2",t,this),wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,wa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Da(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const za=Phaser.Utils.Objects.GetValue;class Xa extends ba{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(za(e,"color",null),za(e,"color2",null),za(e,"horizontalGradient",!0)),this.setStroke(za(e,"stroke",null),za(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,za(t,"color2",null),za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,za(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Aa=Phaser.Utils.Objects.GetValue;class Fa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Aa(t,"bold",!1)),this.setItalic(Aa(t,"italic",!1)),this.setFontSize(Aa(t,"fontSize","16px")),this.setFontFamily(Aa(t,"fontFamily","Courier")),this.setColor(Aa(t,"color","#fff")),this.setStrokeStyle(Aa(t,"stroke",null),Aa(t,"strokeThickness",0)),this.setShadow(Aa(t,"shadowColor",null),Aa(t,"shadowOffsetX",0),Aa(t,"shadowOffsetY",0),Aa(t,"shadowBlur",0)),this.setOffset(Aa(t,"offsetX",0),Aa(t,"offsetY",0)),this.setSpace(Aa(t,"leftSpace",0),Aa(t,"rightSpace",0)),this.setAlign(Aa(t,"align",void 0)),this.setBackgroundColor(Aa(t,"backgroundColor",null)),this.setBackgroundHeight(Aa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Aa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(wa("stroke",t,this),wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(wa("shadowOffsetX",t,this),wa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Fa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ia=Phaser.Utils.Array.Remove,Wa=Phaser.Utils.Array.Remove,ja="text",Ba="image",Ha="drawer",Na="space",Ua="command";var Ga=function(t){return t.type===ja&&"\n"===t.text},Va=function(t){return t.type===ja&&"\f"===t.text},Ja=function(t){return t.type===ja};class $a extends ba{constructor(t,e,i){super(t,ja),this.updateTextFlag=!1,this.style=new Fa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var qa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Za=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Ka extends ba{constructor(t,e,i){super(t,Ba),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Za.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Za.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Qa extends ba{constructor(t,e,i,s){super(t,Ha),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class to extends ba{constructor(t,e){super(t,Na),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class eo extends Qh{constructor(t,e,i,s,r){super(t,Ua),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function io(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>io(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=io(t[i]));return e}var so=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ro={none:0,word:1,char:2,character:2,mix:3};var no=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=lo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=lo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=uo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=uo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=uo(t,"wrapMode");void 0===c&&(c=uo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ro[c]);var u=uo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=uo(t,"letterSpacing",0),v=uo(t,"hAlign",0),g=uo(t,"vAlign",0),f=uo(t,"justifyPercentage",.25),m=so({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=go(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=go(t,"maxLines",0);var a=0===i,o=go(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=go(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=go(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=go(t,"letterSpacing",0),p=go(t,"rtl",!0),v=go(t,"hAlign",p?2:0),g=go(t,"vAlign",0),f=so({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return _e(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Wa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ja);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),va(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Wo=Phaser.Utils.Objects.GetFastValue;var jo={};class Bo{constructor(t){this.pools=Wo(t,"pools",jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Io),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=qo(t,r,e,i,n),a=0;a<=Vo&&0!==h;a++){if((r+=h)<0){r=0;break}h=qo(t,r,e,i,n)}return a===Vo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Zo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},qo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Zo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Ko=Phaser.Utils.Objects.GetValue,Qo=Phaser.Utils.Objects.GetValue;class tl extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Qo(e,"background",void 0),r=Qo(e,"icon",void 0),n=Qo(e,"iconMask",void 0),h=Qo(e,"text",void 0),a=Qo(e,"action",void 0),o=Qo(e,"actionMask",void 0),l=Qo(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Qo(e,"space.icon",0),top:Qo(e,"space.iconTop",0),bottom:Qo(e,"space.iconBottom",0),left:Qo(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Qo(e,"space.icon",0),left:Qo(e,"space.iconLeft",0),right:Qo(e,"space.iconRight",0),top:Qo(e,"space.iconTop",0)});var d=Qo(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mh.call(this,r,r,1)),!d){var c=Qo(e,"iconSize",void 0);this.setIconSize(Qo(e,"iconWidth",c),Qo(e,"iconHeight",c))}}if(h){var u=Qo(e,"wrapText",!1),p=Qo(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),jh(h,u),e.expandTextWidth=!0,Go(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Ko(e,"minWidth",0),s=Ko(e,"minHeight",0),r=Ko(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Jo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Jo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Qo(e,"space.text",0),m=Qo(e,"expandTextWidth",!1),y=Qo(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Qo(e,"space.actionTop",0),bottom:Qo(e,"space.actionBottom",0),right:Qo(e,"space.actionRight",0)}:{left:Qo(e,"space.actionLeft",0),right:Qo(e,"space.actionRight",0),bottom:Qo(e,"space.actionBottom",0)},d=Qo(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mh.call(this,a,a,1)),!d)){var b=Qo(e,"actionSize");this.setActionSize(Qo(e,"actionWidth",b),Qo(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var el=function(t,e){t.popUp(e)},il=function(t,e){t.scaleDown(e)},sl=function(t,e){t.fadeIn(e)},rl=function(t,e){t.fadeOut(e)};const nl={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hl={setDisplayTime(t){return this.displayTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInTime(t){return this.transitInTime=t,this},setTransitInCallback(t){switch("string"==typeof t&&(t=nl[t]),t){case nl.popUp:t=el;break;case nl.fadeIn:t=sl}return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){switch("string"==typeof t&&(t=nl[t]),t){case nl.scaleDown:t=il;break;case nl.fadeOut:t=rl}return t||(t=Xt),this.transitOutCallback=t,this}},al={showMessage(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift()}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[0,[this.emit,"transitin",this,this.transitInTime]],[this.transitInTime,[Xt]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[0,[this.emit,"transitout",this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[Xt]]];return this.player.load(e,this).once("complete",(function(){this.showMessage()}),this).start(),this},removeAllMessages(){return this.messages.length=0,this}};const ol=Phaser.Utils.Objects.GetValue;class ll extends si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.isRunning=ol(t,"isRunning",!1),this.timeScale=ol(t,"timeScale",1),this.now=ol(t,"now",0),this}toJSON(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}start(t){return void 0===t&&(t=0),this.delta=0,this.now=t,super.start(),this}seek(t){return this.now=t,this}setTimeScale(t){return this.timeScale=t,this}tick(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}class dl extends ll{startTicking(){super.startTicking(),this.scene.sys.events.on("update",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&this.scene.sys.events.off("update",this.update,this)}update(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}var cl=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var r=0,n=t.length;r=0;n--)s=gl(t[n],e,i);else for(var n=0,h=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(nr(s)||(s=cl(xl,i,1)),gl(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=wl[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Cl[t]),this.timeUnit=t,this}}var xl=[];const Cl={ms:0,s:1,sec:1},wl={abs:0,absolute:0,inc:1,increment:1},Sl=Phaser.Utils.Objects.GetValue;class Tl extends tl{constructor(t,e){void 0===e&&(e={text:createDefaultTextObject(t)}),super(t,e),this.type="rexToast",this.setTransitInTime(Sl(e,"duration.in",200)),this.setDisplayTime(Sl(e,"duration.hold",1200)),this.setTransitOutTime(Sl(e,"duration.out",200)),this.setTransitInCallback(Sl(e,"transitIn",nl.popUp)),this.setTransitOutCallback(Sl(e,"transitOut",nl.scaleDown)),this.player=new bl(this,{dtMode:1}),this.messages=[],this.scaleX0=void 0,this.scaleY0=void 0,this.setVisible(!1)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,super.destroy(t))}setScale(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,super.setScale(t,e),this}get isShowingMessage(){return this.player.isPlaying}}return Object.assign(Tl.prototype,hl,al),Tl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoast=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=T(t.scaleX,i.scaleX),e.scaleY=T(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=T(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},D={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var j={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=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};const Pe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},_e=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},Ee={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return _e(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return _e(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e,i),this}},Me=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Re=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Le=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ze={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ae=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?pi:ui,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=vi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ci:case ui:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case gi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ui,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===ui}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ui||this.state===pi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,ui=1,pi=2,vi=3,gi=-1;class fi extends hi{constructor(t,e){super(t,e),this.timer=new di}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends fi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=bi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Ti extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Pi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Pi={stop:0,destroy:1,yoyo:2};var Oi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},_i=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return _i(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Mi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Mi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Ri),Di.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class zi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,h):s.resetFromJSON(h),s.restart(),s},Wi=function(t,e,i,s){i instanceof zi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new zi(t,r):s.resetFromJSON(r),s.restart(),s};const ji=Phaser.Utils.Objects.IsPlainObject;var Bi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Bi),Hi.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Gi=Phaser.Math.Linear;class Vi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Gi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Gi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Ki={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=$i(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ei(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=$i(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ei(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ei(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Qi={};Object.assign(Qi,Ki),Qi.onInitEaseMove=function(){Ki.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=fe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ts(i,"magnitude",void 0),t=ts(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ei(this._shake)}};const as=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class cs extends Ke{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ls(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ds(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var us={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),_i(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ps=Phaser.Utils.Array.Remove,vs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ms={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Rs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ls={};Object.assign(Ls,Es,Ms,Rs,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Xs extends Ke{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new _s(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Xs.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return V(e)?e:null}(t);return e?zs(e):t};class As extends Ke{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=zs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Is extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ws=Phaser.Utils.Objects.GetValue;class js extends Ke{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ws(t,"hitAreaMode",0)),this.setEnable(Ws(t,"enable",!0)),this.setStopMode(Ws(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Bs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Bs={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Wi(t,e,!1)}},Gs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Vs=function(t,e){Wi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ns(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback($s(i,"transitIn",Gs)),this.setCoverTransitOutCallback($s(i,"transitOut",Vs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),h=$s(e,"anyTouchClose",!1);$s(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),$s(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ks=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Ks(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},tr=function(t,e,i,s,r){Ks(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Ke{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Sr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:rr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Sr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Or=Phaser.Utils.Objects.GetValue;class kr extends Ke{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Vr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Vr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Zr extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Kr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const un=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Ur{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=gn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=gn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=gn)}get isSwiped(){return this.state===mn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const gn="IDLE",fn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ve(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=On,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],bn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1End();break;case On:this.tracerState=Pn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==On)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(wn.prototype,Ne);var Sn={};const Tn=0,Pn=1,On=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var En=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},Mn={};const Rn=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var zn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Dn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const An="IDLE",Fn="BEGIN",In="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var jn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Ir.call(t,e),Hr.call(t,e),jn.call(t,e),Hn.call(t,e),Un.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",oe),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(h=he(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const sh=Phaser.Utils.Objects.IsPlainObject,rh=Phaser.Utils.Objects.GetValue,nh=Phaser.Display.Align.CENTER,hh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,a,o,l,d,c){pe.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=hh[e];else if(sh(e)){var v;e=rh(v=e,"proportion",void 0),i=rh(v,"align",nh),s=rh(v,"padding",0),r=rh(v,"expand",!1),n=rh(v,"key",void 0),h=rh(v,"index",void 0),t.isRexSizer||(a=rh(v,"minWidth",void 0),o=rh(v,"minHeight",void 0)),l=rh(v,"fitRatio",0),d=rh(v,"offsetX",0),c=rh(v,"offsetY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=nh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ce(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},oh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new eh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return sh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ih.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const lh=_t.prototype.clear;var dh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),lh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,dh.call(this,t),this}},ph={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},vh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},gh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},mh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(We(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),Xe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(mh,oh,uh,ph,vh,gh,fh);var yh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class wh extends qn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):xh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):xh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=yh.call(this)),this._childrenProportion}}Object.assign(wh.prototype,mh);var Sh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Th={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ph extends wh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Sh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Sh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Sh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Sh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ph.prototype,Th);var Oh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)};const kh=Phaser.GameObjects.Graphics;class _h extends kh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Eh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0}(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Oh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Oh.call(this,this.width,this.height,this.padding,t,e)),this}}const Eh={rectangle:0,circle:1};var Mh=function(t,e,i,s){var r=new _h(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Rh=Phaser.GameObjects.Text;var Dh=function(t){return t instanceof Rh};const Lh=Phaser.GameObjects.BitmapText;var Yh=function(t){return t instanceof Lh},Xh=/^[\x00-\x7F]+$/,zh=function(t){return Xh.test(t)},Ah=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Ih=2;const Wh={none:0,word:1,char:Ih,character:Ih,mix:3};var jh=function(t,e){var i=function(t){return Yh(t)?2:Dh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ah;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Wh[e]||0),t.style.wrapMode=e}};const Bh=Phaser.Renderer.WebGL.Utils;var Hh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Bh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Nh=Phaser.Display.Color;var Uh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Nh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Gh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Vh=Phaser.Display.Canvas.CanvasPool,Jh=Phaser.GameObjects.GameObject,$h=Phaser.Utils.String.UUID;class qh extends Jh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Vh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$h(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Vh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Zh=Phaser.GameObjects.Components;Phaser.Class.mixin(qh,[Zh.Alpha,Zh.BlendMode,Zh.Crop,Zh.Depth,Zh.Flip,Zh.GetBounds,Zh.Mask,Zh.Origin,Zh.Pipeline,Zh.PostPipeline,Zh.ScrollFactor,Zh.Tint,Zh.Transform,Zh.Visible,Hh,Uh,Gh]);var Kh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:ws(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&>(this.data),this}};class Qh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Qh.prototype,Kh);var ta={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ea=Phaser.Math.RotateAround;var ia;const sa=Phaser.Geom.Rectangle;var ra,na=function(t){void 0===ra&&(ra=new sa);var e=t.drawTLX,i=t.drawTLY;return ra.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ra};const ha=Phaser.Math.RotateAround;var aa,oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===aa&&(aa={}),s=aa),s.x=e,s.y=i,0!==t.rotation&&ha(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const la=Phaser.GameObjects.Components.TransformMatrix;var da,ca,ua={},pa=function(t,e,i,s,r){var n=oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ua);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===da&&(da=new la,ca=new la),t.parentContainer?t.getWorldTransformMatrix(da,ca):da.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),da.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},va=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return pa(t,e,n,h,r)},ga={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ia&&(ia={}),s=ia),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ea(s,0,0,-i.rotation),s}(t,e,this,!0);return na(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return va(this.parent,this,t,e,i)}};Object.assign(ga,ta);const fa=Phaser.Math.DegToRad,ma=Phaser.Math.RadToDeg,ya=Phaser.Utils.Objects.GetValue;class ba extends Qh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ma(this._rotation)}set angle(t){this.rotation=fa(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ya(t,"width",void 0),i=ya(t,"height",void 0),s=ya(t,"scaleX",void 0),r=ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(ba.prototype,ga);const xa=Phaser.Utils.String.Pad;var Ca=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${xa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Sa=Phaser.Utils.Objects.GetValue;class Ta{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Sa(t,"x",0),i=Sa(t,"y",0));var s=this.cornerRadius;s.tl=Pa(Sa(t,"tl",void 0),e,i),s.tr=Pa(Sa(t,"tr",void 0),e,i),s.bl=Pa(Sa(t,"bl",void 0),e,i),s.br=Pa(Sa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Oa(this.cornerRadius.br,t)}}var Pa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ka(t),t},Oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Sa(e,"x",0),t.y=Sa(e,"y",0)),ka(t)},ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const _a=Phaser.Math.DegToRad;var Ea=function(t){return!t.hasOwnProperty("convex")||t.convex},Ma=function(t){return t.x>0&&t.y>0},Ra=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,o,l,o,l,180,270,!1,h):Ra(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,s-o,l,o,l,270,360,!1,h):Ra(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,s-o,r-l,o,l,0,90,!1,h):Ra(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ma(a)?(o=a.x*g,l=a.y*f,Ea(a)?Ra(t,o,r-l,o,l,90,180,!1,h):Ra(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const La=Phaser.Utils.Objects.GetValue;class Ya extends ba{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(La(e,"color",null),La(e,"color2",null),La(e,"horizontalGradient",!0)),this.setStroke(La(e,"stroke",null),La(e,"strokeThickness",2)),this.setCornerRadius(La(e,"cornerRadius",0),La(e,"cornerIteration",null))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,wa("color2",t,this),wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,wa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Da(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Xa=Phaser.Utils.Objects.GetValue;class za extends ba{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2))}set color(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ca(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Xa(t,"color2",null),Xa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Xa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Aa=Phaser.Utils.Objects.GetValue;class Fa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Aa(t,"bold",!1)),this.setItalic(Aa(t,"italic",!1)),this.setFontSize(Aa(t,"fontSize","16px")),this.setFontFamily(Aa(t,"fontFamily","Courier")),this.setColor(Aa(t,"color","#fff")),this.setStrokeStyle(Aa(t,"stroke",null),Aa(t,"strokeThickness",0)),this.setShadow(Aa(t,"shadowColor",null),Aa(t,"shadowOffsetX",0),Aa(t,"shadowOffsetY",0),Aa(t,"shadowBlur",0)),this.setOffset(Aa(t,"offsetX",0),Aa(t,"offsetY",0)),this.setSpace(Aa(t,"leftSpace",0),Aa(t,"rightSpace",0)),this.setAlign(Aa(t,"align",void 0)),this.setBackgroundColor(Aa(t,"backgroundColor",null)),this.setBackgroundHeight(Aa(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Aa(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(wa("stroke",t,this),wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(wa("shadowOffsetX",t,this),wa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Fa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ca(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ca(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ca(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ca(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Ia=Phaser.Utils.Array.Remove,Wa=Phaser.Utils.Array.Remove,ja="text",Ba="image",Ha="drawer",Na="space",Ua="command";var Ga=function(t){return t.type===ja&&"\n"===t.text},Va=function(t){return t.type===ja&&"\f"===t.text},Ja=function(t){return t.type===ja};class $a extends ba{constructor(t,e,i){super(t,ja),this.updateTextFlag=!1,this.style=new Fa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var qa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Za=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class Ka extends ba{constructor(t,e,i){super(t,Ba),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Za.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Za.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Qa extends ba{constructor(t,e,i,s){super(t,Ha),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class to extends ba{constructor(t,e){super(t,Na),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class eo extends Qh{constructor(t,e,i,s,r){super(t,Ua),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function io(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>io(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=io(t[i]));return e}var so=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const ro={none:0,word:1,char:2,character:2,mix:3};var no=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=lo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=lo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=uo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=uo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=uo(t,"wrapMode");void 0===c&&(c=uo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=ro[c]);var u=uo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=uo(t,"letterSpacing",0),v=uo(t,"hAlign",0),g=uo(t,"vAlign",0),f=uo(t,"justifyPercentage",.25),m=so({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),D=Math.max(D,R)),m.start+=_.length,m.isLastPage=!L&&m.start===k,m.maxLineWidth=D,m.linesHeight=E.length*n;var W=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,j=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=go(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=go(t,"maxLines",0);var a=0===i,o=go(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=go(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=go(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=go(t,"letterSpacing",0),p=go(t,"rtl",!0),v=go(t,"hAlign",p?2:0),g=go(t,"vAlign",0),f=so({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===O,f.maxLineHeight=R,f.linesWidth=_.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return _e(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ia(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Wa(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ja);return null===i?i=new $a(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),va(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Wo=Phaser.Utils.Objects.GetFastValue;var jo={};class Bo{constructor(t){this.pools=Wo(t,"pools",jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Io),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=qo(t,r,e,i,n),a=0;a<=Vo&&0!==h;a++){if((r+=h)<0){r=0;break}h=qo(t,r,e,i,n)}return a===Vo&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Zo(t,e,i),t},$o=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},qo=function(t,e,i,s,r){var n,h=$o(t,e,r),a=$o(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Zo=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Ko=Phaser.Utils.Objects.GetValue,Qo=Phaser.Utils.Objects.GetValue;class tl extends Ph{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Qo(e,"background",void 0),r=Qo(e,"icon",void 0),n=Qo(e,"iconMask",void 0),h=Qo(e,"text",void 0),a=Qo(e,"action",void 0),o=Qo(e,"actionMask",void 0),l=Qo(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Qo(e,"space.icon",0),top:Qo(e,"space.iconTop",0),bottom:Qo(e,"space.iconBottom",0),left:Qo(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Qo(e,"space.icon",0),left:Qo(e,"space.iconLeft",0),right:Qo(e,"space.iconRight",0),top:Qo(e,"space.iconTop",0)});var d=Qo(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mh.call(this,r,r,1)),!d){var c=Qo(e,"iconSize",void 0);this.setIconSize(Qo(e,"iconWidth",c),Qo(e,"iconHeight",c))}}if(h){var u=Qo(e,"wrapText",!1),p=Qo(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),jh(h,u),e.expandTextWidth=!0,Go(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Ko(e,"minWidth",0),s=Ko(e,"minHeight",0),r=Ko(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Jo(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Jo(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Qo(e,"space.text",0),m=Qo(e,"expandTextWidth",!1),y=Qo(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Qo(e,"space.actionTop",0),bottom:Qo(e,"space.actionBottom",0),right:Qo(e,"space.actionRight",0)}:{left:Qo(e,"space.actionLeft",0),right:Qo(e,"space.actionRight",0),bottom:Qo(e,"space.actionBottom",0)},d=Qo(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mh.call(this,a,a,1)),!d)){var b=Qo(e,"actionSize");this.setActionSize(Qo(e,"actionWidth",b),Qo(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var el=function(t,e){t.popUp(e)},il=function(t,e){t.scaleDown(e)},sl=function(t,e){t.fadeIn(e)},rl=function(t,e){t.fadeOut(e)};const nl={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hl={setDisplayTime(t){return this.displayTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInTime(t){return this.transitInTime=t,this},setTransitInCallback(t){switch("string"==typeof t&&(t=nl[t]),t){case nl.popUp:t=el;break;case nl.fadeIn:t=sl}return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){switch("string"==typeof t&&(t=nl[t]),t){case nl.scaleDown:t=il;break;case nl.fadeOut:t=rl}return t||(t=zt),this.transitOutCallback=t,this}},al={showMessage(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift()}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[0,[this.emit,"transitin",this,this.transitInTime]],[this.transitInTime,[zt]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[0,[this.emit,"transitout",this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[zt]]];return this.player.load(e,this).once("complete",(function(){this.showMessage()}),this).start(),this},removeAllMessages(){return this.messages.length=0,this}};const ol=Phaser.Utils.Objects.GetValue;class ll extends si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.isRunning=ol(t,"isRunning",!1),this.timeScale=ol(t,"timeScale",1),this.now=ol(t,"now",0),this}toJSON(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}start(t){return void 0===t&&(t=0),this.delta=0,this.now=t,super.start(),this}seek(t){return this.now=t,this}setTimeScale(t){return this.timeScale=t,this}tick(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}class dl extends ll{startTicking(){super.startTicking(),this.scene.sys.events.on("update",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&this.scene.sys.events.off("update",this.update,this)}update(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}var cl=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var r=0,n=t.length;r=0;n--)s=gl(t[n],e,i);else for(var n=0,h=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(nr(s)||(s=cl(xl,i,1)),gl(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=wl[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=Cl[t]),this.timeUnit=t,this}}var xl=[];const Cl={ms:0,s:1,sec:1},wl={abs:0,absolute:0,inc:1,increment:1},Sl=Phaser.Utils.Objects.GetValue;class Tl extends tl{constructor(t,e){void 0===e&&(e={text:createDefaultTextObject(t)}),super(t,e),this.type="rexToast",this.setTransitInTime(Sl(e,"duration.in",200)),this.setDisplayTime(Sl(e,"duration.hold",1200)),this.setTransitOutTime(Sl(e,"duration.out",200)),this.setTransitInCallback(Sl(e,"transitIn",nl.popUp)),this.setTransitOutCallback(Sl(e,"transitOut",nl.scaleDown)),this.player=new bl(this,{dtMode:1}),this.messages=[],this.scaleX0=void 0,this.scaleY0=void 0,this.setVisible(!1)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,super.destroy(t))}setScale(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,super.setScale(t,e),this}get isShowingMessage(){return this.player.isPlaying}}return Object.assign(Tl.prototype,hl,al),Tl},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoast=e(); diff --git a/dist/rextrees.js b/dist/rextrees.js index e73aca0010..586b7367d9 100644 --- a/dist/rextrees.js +++ b/dist/rextrees.js @@ -12192,7 +12192,7 @@ var LayoutChildren$2 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12218,8 +12218,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12248,10 +12248,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12261,14 +12261,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12466,6 +12469,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -12491,6 +12495,9 @@ } fitRatio = GetValue$R(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$R(config, 'offsetX', 0); + offsetY = GetValue$R(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12531,12 +12538,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rextrees.min.js b/dist/rextrees.min.js index f61ccaad05..a0b1a6fe1a 100644 --- a/dist/rextrees.min.js +++ b/dist/rextrees.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Fs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends Fs{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Cr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Wn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},wh=function(t){return"string"==typeof t&&(t=xh[t]),t};const Sh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class Oh extends qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,yh);var Ph=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Th extends zs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var _h={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},kh=function(t,e){Di.popUp.call(t,e,this.expandDirection)},Eh=function(t,e){Di.scaleDown.call(t,e,this.expandDirection)},Mh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=kh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Eh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Rh=Phaser.Utils.Objects.GetValue;class Lh extends Oh{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Rh(e,"space"),h=1===this.orientation?"left":"top",a=Rh(e,"align.title",h),o=Rh(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Rh(n,"titleLeft",0),right:Rh(n,"titleRight",0),top:Rh(n,"titleTop",0),bottom:Rh(n,"titleBottom",0)}});var l=Rh(e,"toggleByTarget",void 0),d=Rh(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&mr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Th(r),!Rh(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Rh(e,"align.child","left");var u=(o=Rh(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Rh(n,"childLeft",0),right:Rh(n,"childRight",0),top:Rh(n,"childTop",0),bottom:Rh(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Rh(p,"duration",200)),this.setExpandCallback(Rh(p,"expandCallback",void 0)),this.setCollapseCallback(Rh(p,"collapseCallback",void 0)),this.reLayoutTarget=Rh(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Rh(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Lh.prototype,_h,Mh);var Dh={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},Ah=function(t,e,i,s,r=!1){var n;return yt(e)?(n=e,delete e[key]):Qs(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Yh=Phaser.Renderer.WebGL.Utils,zh=function(t,e,i,s,r,n){for(var h=Yh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ih=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Bh=Phaser.Renderer.Canvas.SetTransform;var Hh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&zh(r,h,e,l,a,o),e.isStroked&&Wh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Bh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Gh.prototype,Hh);const Vh=Phaser.Utils.Objects.GetValue;let Uh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Vh(t,"x",0),i=Vh(t,"y",0));var s=this.cornerRadius;s.tl=$h(Vh(t,"tl",void 0),e,i),s.tr=$h(Vh(t,"tr",void 0),e,i),s.bl=$h(Vh(t,"bl",void 0),e,i),s.br=$h(Vh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Jh(this.cornerRadius.br,t)}};var $h=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Kh(t),t},Jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vh(e,"x",0),t.y=Vh(e,"y",0)),Kh(t)},Kh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},qh=function(t){return t.x>0&&t.y>0},Zh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Qh=Phaser.Math.DegToRad;var ta=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.IsPlainObject;class so extends(_a(ba)){constructor(t,e,i,s,r,n,h,a){io(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):io(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):io(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Qa).setName("trackFill")).addShape((new Qa).setName("bar")).addShape((new Qa).setName("trackStroke")),this.setTrackColor(eo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eo(a,"trackStrokeThickness",2),eo(a,"trackStrokeColor",void 0)),this.setSkewX(eo(a,"skewX",0)),this.setRTL(eo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ro={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&to(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),to(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&to(a,0,0,e,i,t)}};Object.assign(so.prototype,ro);var no=function(t){return null==t||""===t||0===t.length},ho=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(no(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(no(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nPo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Po(t[i]));return e}const To=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue;var ko=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Eo={scale:0,repeat:1};var Mo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ro={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Oo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Po(i),s=Po(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return To(t)?(this.stretchMode.edge=ko(_o(t,"edge",0)),this.stretchMode.internal=ko(_o(t,"internal",0))):(t=ko(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Mo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.GameObjects;var Yo=void 0,zo=function(t,e){if(Yo||(Yo={},qe(t).events.once("destroy",(function(){for(var t in Yo)Yo[t].destroy();Yo=void 0}))),!Yo.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Ao[e](i)).setOrigin(0),Yo[e]=t}return Yo[e]};const Xo=Phaser.GameObjects.RenderTexture;class Wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Lo(i)?(i=Do(d=i,"x",0),s=Do(d,"y",0),r=Do(d,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(r)?(r=Do(d=r,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(h)?(h=Do(d=h,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(a)?(a=Do(d=a,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Do(d,"baseFrame",void 0)):Lo(o)&&(o=Do(d=o,"columns",void 0),l=Do(d,"rows",void 0)),void 0===a&&(a=Do(d,"frame",void 0)),void 0===o){var c=Do(d,"leftWidth",void 0),u=Do(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Do(d,"topHeight",void 0),v=Do(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Do(d,"getFrameNameCallback",void 0)),this.setStretchMode(Do(d,"stretchMode",0)),this.setPreserveRatio(Do(d,"preserveRatio",!0));var g=Do(d,"maxFixedPartScale",1),f=Do(d,"maxFixedPartScaleX",g),m=Do(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ro),i}(Xo,"rexNinePatch")){}var jo={_drawImage:function(t,e,i,s,r,n){var h=zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Wo.prototype,jo);let Fo=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lo(t,e))return t[e];var i=t.parent;return lo(i,e)?i[e]:void 0}set(t,e,i){return lo(t,e)?t[e]=i:lo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Io=Phaser.Utils.Objects.GetValue;class Bo extends Wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Io(e,"effects",!0);i&&go(this,i),this.style=new Fo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Bo.prototype,ca);const Ho=["alpha","tint","flipX","flipY"];var No=function(t,e){if(!e)return t;for(var i=0,s=Ho.length;i0&&r.push(o.join("")),r},cl=0,ul=1,pl=2,vl=0,gl=1,fl=2,ml=/(?:\r\n|\r|\n)/;const yl={none:vl,word:gl,char:fl,character:fl,mix:3},bl=Phaser.Renderer.WebGL.Utils;var xl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=bl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const wl=Phaser.Display.Color;var Sl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new wl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Cl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},Ol={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Cl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Pl=Phaser.Display.Canvas.CanvasPool,Tl=Phaser.GameObjects.GameObject,_l=Phaser.Utils.String.UUID;class kl extends Tl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Pl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=_l(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Pl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const El=Phaser.GameObjects.Components;Phaser.Class.mixin(kl,[El.Alpha,El.BlendMode,El.Crop,El.Depth,El.Flip,El.GetBounds,El.Mask,El.Origin,El.Pipeline,El.PostPipeline,El.ScrollFactor,El.Tint,El.Transform,El.Visible,xl,Sl,Ol]);class Ml{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Ml.prototype,Ea);var Rl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Ll=Phaser.Math.RotateAround;var Dl;const Al=Phaser.Geom.Rectangle;var Yl,zl=function(t){void 0===Yl&&(Yl=new Al);var e=t.drawTLX,i=t.drawTLY;return Yl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yl};const Xl=Phaser.Math.RotateAround;var Wl,jl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Wl&&(Wl={}),s=Wl),s.x=e,s.y=i,0!==t.rotation&&Xl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Fl=Phaser.GameObjects.Components.TransformMatrix;var Il,Bl,Hl={},Nl=function(t,e,i,s,r){var n=jl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Hl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Il&&(Il=new Fl,Bl=new Fl),t.parentContainer?t.getWorldTransformMatrix(Il,Bl):Il.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Il.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Gl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Nl(t,e,n,h,r)},Vl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Dl&&(Dl={}),s=Dl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ll(s,0,0,-i.rotation),s}(t,e,this,!0);return zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gl(this.parent,this,t,e,i)}};Object.assign(Vl,Rl);const Ul=Phaser.Math.DegToRad,$l=Phaser.Math.RadToDeg,Jl=Phaser.Utils.Objects.GetValue;class Kl extends Ml{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return $l(this._rotation)}set angle(t){this.rotation=Ul(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Jl(t,"width",void 0),i=Jl(t,"height",void 0),s=Jl(t,"scaleX",void 0),r=Jl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Kl.prototype,Vl);const ql=Phaser.Utils.String.Pad;var Zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ql(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ql=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const td=Phaser.Math.DegToRad;var ed=function(t){return!t.hasOwnProperty("convex")||t.convex},id=function(t){return t.x>0&&t.y>0},sd=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,l,o,l,180,270,!1,h):sd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,l,o,l,270,360,!1,h):sd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,r-l,o,l,0,90,!1,h):sd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,r-l,o,l,90,180,!1,h):sd(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},nd=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),rd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const hd=Phaser.Utils.Objects.GetValue;class ad extends Kl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(hd(e,"color",null),hd(e,"color2",null),hd(e,"horizontalGradient",!0)),this.setStroke(hd(e,"stroke",null),hd(e,"strokeThickness",2)),this.setCornerRadius(hd(e,"cornerRadius",0),hd(e,"cornerIteration",null))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ql("color2",t,this),Ql("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ql("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ql("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){nd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const od=Phaser.Utils.Objects.GetValue;class ld extends Kl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(od(e,"color",null),od(e,"color2",null),od(e,"horizontalGradient",!0)),this.setStroke(od(e,"stroke",null),od(e,"strokeThickness",2))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,od(t,"color2",null),od(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,od(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const dd=Phaser.Utils.Objects.GetValue;let cd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(dd(t,"bold",!1)),this.setItalic(dd(t,"italic",!1)),this.setFontSize(dd(t,"fontSize","16px")),this.setFontFamily(dd(t,"fontFamily","Courier")),this.setColor(dd(t,"color","#fff")),this.setStrokeStyle(dd(t,"stroke",null),dd(t,"strokeThickness",0)),this.setShadow(dd(t,"shadowColor",null),dd(t,"shadowOffsetX",0),dd(t,"shadowOffsetY",0),dd(t,"shadowBlur",0)),this.setOffset(dd(t,"offsetX",0),dd(t,"offsetY",0)),this.setSpace(dd(t,"leftSpace",0),dd(t,"rightSpace",0)),this.setAlign(dd(t,"align",void 0)),this.setBackgroundColor(dd(t,"backgroundColor",null)),this.setBackgroundHeight(dd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(dd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ql("stroke",t,this),Ql("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ql("shadowOffsetX",t,this),Ql("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Zl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Zl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const ud=Phaser.Utils.Array.Remove,pd=Phaser.Utils.Array.Remove,vd="text",gd="image",fd="drawer",md="space",yd="command";var bd=function(t){return t.type===vd&&"\n"===t.text},xd=function(t){return t.type===vd&&"\f"===t.text},wd=function(t){return t.type===vd};class Sd extends Kl{constructor(t,e,i){super(t,vd),this.updateTextFlag=!1,this.style=new cd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Cd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Od=Phaser.Display.Canvas.CanvasPool;var Pd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Od.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Od.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Td extends Kl{constructor(t,e,i){super(t,gd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class _d extends Kl{constructor(t,e,i,s){super(t,fd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class kd extends Kl{constructor(t,e){super(t,md),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ed extends Ml{constructor(t,e,i,s,r){super(t,yd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Md=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Rd={none:0,word:1,char:2,character:2,mix:3};var Ld=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=zd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=zd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wd(t,"wrapMode");void 0===c&&(c=Wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Rd[c]);var u=Wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wd(t,"letterSpacing",0),v=Wd(t,"hAlign",0),g=Wd(t,"vAlign",0),f=Wd(t,"justifyPercentage",.25),m=Md({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Id(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Id(t,"maxLines",0);var a=0===i,o=Id(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Id(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Id(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Id(t,"letterSpacing",0),p=Id(t,"rtl",!0),v=Id(t,"hAlign",p?2:0),g=Id(t,"vAlign",0),f=Md({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ud(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return pd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(vd);return null===i?i=new Sd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Gl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const uc=Phaser.Utils.Objects.GetFastValue;var pc={};class vc{constructor(t){this.pools=uc(t,"pools",pc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new cc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Sc(t,r,e,i,n),a=0;a<=bc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sc(t,r,e,i,n)}return a===bc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Cc(t,e,i),t},wc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sc=function(t,e,i,s,r){var n,h=wc(t,e,r),a=wc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Cc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Oc=Phaser.Utils.Objects.GetValue,Pc=Phaser.Utils.Objects.GetValue;class Tc extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Pc(e,"background",void 0),r=Pc(e,"icon",void 0),n=Pc(e,"iconMask",void 0),h=Pc(e,"text",void 0),a=Pc(e,"action",void 0),o=Pc(e,"actionMask",void 0),l=Pc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Pc(e,"space.icon",0),top:Pc(e,"space.iconTop",0),bottom:Pc(e,"space.iconBottom",0),left:Pc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Pc(e,"space.icon",0),left:Pc(e,"space.iconLeft",0),right:Pc(e,"space.iconRight",0),top:Pc(e,"space.iconTop",0)});var d=Pc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=el.call(this,r,r,1)),!d){var c=Pc(e,"iconSize",void 0);this.setIconSize(Pc(e,"iconWidth",c),Pc(e,"iconHeight",c))}}if(h){var u=Pc(e,"wrapText",!1),p=Pc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(hl(t)){case 0:switch("string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ll;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,yc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Oc(e,"minWidth",0),s=Oc(e,"minHeight",0),r=Oc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return xc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),xc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Pc(e,"space.text",0),m=Pc(e,"expandTextWidth",!1),y=Pc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Pc(e,"space.actionTop",0),bottom:Pc(e,"space.actionBottom",0),right:Pc(e,"space.actionRight",0)}:{left:Pc(e,"space.actionLeft",0),right:Pc(e,"space.actionRight",0),bottom:Pc(e,"space.actionBottom",0)},d=Pc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=el.call(this,a,a,1)),!d)){var b=Pc(e,"actionSize");this.setActionSize(Pc(e,"actionWidth",b),Pc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const _c=Phaser.GameObjects.Text,kc=Phaser.Utils.Objects.GetValue;class Ec extends _c{constructor(t,e){void 0===e&&(e={}),super(t,kc(e,"x",0),kc(e,"y",0),kc(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Ec.prototype,ca);var Mc=Phaser.Renderer.WebGL.Utils,Rc={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Mc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Lc=Phaser.Display.Canvas.CanvasPool;e();const Dc=Phaser.GameObjects.GameObject;class Ac extends Dc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Lc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Lc.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Le=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},De=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},We=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ri(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Pi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const qi=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=es(i,"magnitude",void 0),t=es(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ds(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(cs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},vs=Phaser.Utils.Array.Remove,gs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=$e(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ls={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ds={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class Ws extends Qe{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Xs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;class Fs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends Fs{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ks(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Js(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Cr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?yr:nr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Sr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Pr extends ks{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Er={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(vn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==_n)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Wn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new qr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l,d,c){ve.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ah[e];else if(rh(e)){var v;e=nh(v=e,"proportion",void 0),i=nh(v,"align",hh),s=nh(v,"padding",0),r=nh(v,"expand",!1),n=nh(v,"key",void 0),h=nh(v,"index",void 0),t.isRexSizer||(a=nh(v,"minWidth",void 0),o=nh(v,"minHeight",void 0)),l=nh(v,"fitRatio",0),d=nh(v,"offsetX",0),c=nh(v,"offsetY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(u?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=ue(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ch.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var bh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},wh=function(t){return"string"==typeof t&&(t=xh[t]),t};const Sh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class Oh extends qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(n)&&(n=Ch(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=bh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,yh);var Ph=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Th extends zs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var _h={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},kh=function(t,e){Di.popUp.call(t,e,this.expandDirection)},Eh=function(t,e){Di.scaleDown.call(t,e,this.expandDirection)},Mh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=kh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Eh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Rh=Phaser.Utils.Objects.GetValue;class Lh extends Oh{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Rh(e,"space"),h=1===this.orientation?"left":"top",a=Rh(e,"align.title",h),o=Rh(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Rh(n,"titleLeft",0),right:Rh(n,"titleRight",0),top:Rh(n,"titleTop",0),bottom:Rh(n,"titleBottom",0)}});var l=Rh(e,"toggleByTarget",void 0),d=Rh(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&mr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Th(r),!Rh(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Rh(e,"align.child","left");var u=(o=Rh(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Rh(n,"childLeft",0),right:Rh(n,"childRight",0),top:Rh(n,"childTop",0),bottom:Rh(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Rh(p,"duration",200)),this.setExpandCallback(Rh(p,"expandCallback",void 0)),this.setCollapseCallback(Rh(p,"collapseCallback",void 0)),this.reLayoutTarget=Rh(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Rh(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Lh.prototype,_h,Mh);var Dh={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},Ah=function(t,e,i,s,r=!1){var n;return yt(e)?(n=e,delete e[key]):Qs(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Yh=Phaser.Renderer.WebGL.Utils,zh=function(t,e,i,s,r,n){for(var h=Yh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ih=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Bh=Phaser.Renderer.Canvas.SetTransform;var Hh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&zh(r,h,e,l,a,o),e.isStroked&&Wh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Bh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Gh.prototype,Hh);const Vh=Phaser.Utils.Objects.GetValue;let Uh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Vh(t,"x",0),i=Vh(t,"y",0));var s=this.cornerRadius;s.tl=$h(Vh(t,"tl",void 0),e,i),s.tr=$h(Vh(t,"tr",void 0),e,i),s.bl=$h(Vh(t,"bl",void 0),e,i),s.br=$h(Vh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Jh(this.cornerRadius.br,t)}};var $h=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Kh(t),t},Jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vh(e,"x",0),t.y=Vh(e,"y",0)),Kh(t)},Kh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},qh=function(t){return t.x>0&&t.y>0},Zh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Qh=Phaser.Math.DegToRad;var ta=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.IsPlainObject;class so extends(_a(ba)){constructor(t,e,i,s,r,n,h,a){io(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):io(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):io(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Qa).setName("trackFill")).addShape((new Qa).setName("bar")).addShape((new Qa).setName("trackStroke")),this.setTrackColor(eo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eo(a,"trackStrokeThickness",2),eo(a,"trackStrokeColor",void 0)),this.setSkewX(eo(a,"skewX",0)),this.setRTL(eo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ro={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&to(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),to(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&to(a,0,0,e,i,t)}};Object.assign(so.prototype,ro);var no=function(t){return null==t||""===t||0===t.length},ho=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(no(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(no(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nPo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Po(t[i]));return e}const To=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue;var ko=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Eo={scale:0,repeat:1};var Mo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ro={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Oo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Po(i),s=Po(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return To(t)?(this.stretchMode.edge=ko(_o(t,"edge",0)),this.stretchMode.internal=ko(_o(t,"internal",0))):(t=ko(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Mo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.GameObjects;var Yo=void 0,zo=function(t,e){if(Yo||(Yo={},qe(t).events.once("destroy",(function(){for(var t in Yo)Yo[t].destroy();Yo=void 0}))),!Yo.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Ao[e](i)).setOrigin(0),Yo[e]=t}return Yo[e]};const Xo=Phaser.GameObjects.RenderTexture;class Wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Lo(i)?(i=Do(d=i,"x",0),s=Do(d,"y",0),r=Do(d,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(r)?(r=Do(d=r,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(h)?(h=Do(d=h,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(a)?(a=Do(d=a,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Do(d,"baseFrame",void 0)):Lo(o)&&(o=Do(d=o,"columns",void 0),l=Do(d,"rows",void 0)),void 0===a&&(a=Do(d,"frame",void 0)),void 0===o){var c=Do(d,"leftWidth",void 0),u=Do(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Do(d,"topHeight",void 0),v=Do(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Do(d,"getFrameNameCallback",void 0)),this.setStretchMode(Do(d,"stretchMode",0)),this.setPreserveRatio(Do(d,"preserveRatio",!0));var g=Do(d,"maxFixedPartScale",1),f=Do(d,"maxFixedPartScaleX",g),m=Do(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ro),i}(Xo,"rexNinePatch")){}var jo={_drawImage:function(t,e,i,s,r,n){var h=zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Wo.prototype,jo);let Fo=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lo(t,e))return t[e];var i=t.parent;return lo(i,e)?i[e]:void 0}set(t,e,i){return lo(t,e)?t[e]=i:lo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Io=Phaser.Utils.Objects.GetValue;class Bo extends Wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Io(e,"effects",!0);i&&go(this,i),this.style=new Fo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Bo.prototype,ca);const Ho=["alpha","tint","flipX","flipY"];var No=function(t,e){if(!e)return t;for(var i=0,s=Ho.length;i0&&r.push(o.join("")),r},cl=0,ul=1,pl=2,vl=0,gl=1,fl=2,ml=/(?:\r\n|\r|\n)/;const yl={none:vl,word:gl,char:fl,character:fl,mix:3},bl=Phaser.Renderer.WebGL.Utils;var xl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=bl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const wl=Phaser.Display.Color;var Sl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new wl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},Cl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},Ol={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Cl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Pl=Phaser.Display.Canvas.CanvasPool,Tl=Phaser.GameObjects.GameObject,_l=Phaser.Utils.String.UUID;class kl extends Tl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Pl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=_l(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Pl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const El=Phaser.GameObjects.Components;Phaser.Class.mixin(kl,[El.Alpha,El.BlendMode,El.Crop,El.Depth,El.Flip,El.GetBounds,El.Mask,El.Origin,El.Pipeline,El.PostPipeline,El.ScrollFactor,El.Tint,El.Transform,El.Visible,xl,Sl,Ol]);class Ml{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Ml.prototype,Ea);var Rl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Ll=Phaser.Math.RotateAround;var Dl;const Al=Phaser.Geom.Rectangle;var Yl,zl=function(t){void 0===Yl&&(Yl=new Al);var e=t.drawTLX,i=t.drawTLY;return Yl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yl};const Xl=Phaser.Math.RotateAround;var Wl,jl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Wl&&(Wl={}),s=Wl),s.x=e,s.y=i,0!==t.rotation&&Xl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Fl=Phaser.GameObjects.Components.TransformMatrix;var Il,Bl,Hl={},Nl=function(t,e,i,s,r){var n=jl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Hl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Il&&(Il=new Fl,Bl=new Fl),t.parentContainer?t.getWorldTransformMatrix(Il,Bl):Il.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Il.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Gl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Nl(t,e,n,h,r)},Vl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Dl&&(Dl={}),s=Dl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ll(s,0,0,-i.rotation),s}(t,e,this,!0);return zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gl(this.parent,this,t,e,i)}};Object.assign(Vl,Rl);const Ul=Phaser.Math.DegToRad,$l=Phaser.Math.RadToDeg,Jl=Phaser.Utils.Objects.GetValue;class Kl extends Ml{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return $l(this._rotation)}set angle(t){this.rotation=Ul(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Jl(t,"width",void 0),i=Jl(t,"height",void 0),s=Jl(t,"scaleX",void 0),r=Jl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Kl.prototype,Vl);const ql=Phaser.Utils.String.Pad;var Zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ql(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Ql=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const td=Phaser.Math.DegToRad;var ed=function(t){return!t.hasOwnProperty("convex")||t.convex},id=function(t){return t.x>0&&t.y>0},sd=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,l,o,l,180,270,!1,h):sd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,l,o,l,270,360,!1,h):sd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,r-l,o,l,0,90,!1,h):sd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,r-l,o,l,90,180,!1,h):sd(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},nd=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),rd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const hd=Phaser.Utils.Objects.GetValue;class ad extends Kl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(hd(e,"color",null),hd(e,"color2",null),hd(e,"horizontalGradient",!0)),this.setStroke(hd(e,"stroke",null),hd(e,"strokeThickness",2)),this.setCornerRadius(hd(e,"cornerRadius",0),hd(e,"cornerIteration",null))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ql("color2",t,this),Ql("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ql("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ql("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){nd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const od=Phaser.Utils.Objects.GetValue;class ld extends Kl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(od(e,"color",null),od(e,"color2",null),od(e,"horizontalGradient",!0)),this.setStroke(od(e,"stroke",null),od(e,"strokeThickness",2))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,od(t,"color2",null),od(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,od(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const dd=Phaser.Utils.Objects.GetValue;let cd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(dd(t,"bold",!1)),this.setItalic(dd(t,"italic",!1)),this.setFontSize(dd(t,"fontSize","16px")),this.setFontFamily(dd(t,"fontFamily","Courier")),this.setColor(dd(t,"color","#fff")),this.setStrokeStyle(dd(t,"stroke",null),dd(t,"strokeThickness",0)),this.setShadow(dd(t,"shadowColor",null),dd(t,"shadowOffsetX",0),dd(t,"shadowOffsetY",0),dd(t,"shadowBlur",0)),this.setOffset(dd(t,"offsetX",0),dd(t,"offsetY",0)),this.setSpace(dd(t,"leftSpace",0),dd(t,"rightSpace",0)),this.setAlign(dd(t,"align",void 0)),this.setBackgroundColor(dd(t,"backgroundColor",null)),this.setBackgroundHeight(dd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(dd(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ql("stroke",t,this),Ql("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ql("shadowOffsetX",t,this),Ql("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Zl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Zl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const ud=Phaser.Utils.Array.Remove,pd=Phaser.Utils.Array.Remove,vd="text",gd="image",fd="drawer",md="space",yd="command";var bd=function(t){return t.type===vd&&"\n"===t.text},xd=function(t){return t.type===vd&&"\f"===t.text},wd=function(t){return t.type===vd};class Sd extends Kl{constructor(t,e,i){super(t,vd),this.updateTextFlag=!1,this.style=new cd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Cd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Od=Phaser.Display.Canvas.CanvasPool;var Pd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=Od.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Od.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Td extends Kl{constructor(t,e,i){super(t,gd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class _d extends Kl{constructor(t,e,i,s){super(t,fd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class kd extends Kl{constructor(t,e){super(t,md),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Ed extends Ml{constructor(t,e,i,s,r){super(t,yd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Md=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Rd={none:0,word:1,char:2,character:2,mix:3};var Ld=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=zd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=zd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wd(t,"wrapMode");void 0===c&&(c=Wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Rd[c]);var u=Wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wd(t,"letterSpacing",0),v=Wd(t,"hAlign",0),g=Wd(t,"vAlign",0),f=Wd(t,"justifyPercentage",.25),m=Md({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Id(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Id(t,"maxLines",0);var a=0===i,o=Id(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Id(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Id(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Id(t,"letterSpacing",0),p=Id(t,"rtl",!0),v=Id(t,"hAlign",p?2:0),g=Id(t,"vAlign",0),f=Md({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ud(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return pd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(vd);return null===i?i=new Sd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Gl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const uc=Phaser.Utils.Objects.GetFastValue;var pc={};class vc{constructor(t){this.pools=uc(t,"pools",pc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new cc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Sc(t,r,e,i,n),a=0;a<=bc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sc(t,r,e,i,n)}return a===bc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Cc(t,e,i),t},wc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sc=function(t,e,i,s,r){var n,h=wc(t,e,r),a=wc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Cc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Oc=Phaser.Utils.Objects.GetValue,Pc=Phaser.Utils.Objects.GetValue;class Tc extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Pc(e,"background",void 0),r=Pc(e,"icon",void 0),n=Pc(e,"iconMask",void 0),h=Pc(e,"text",void 0),a=Pc(e,"action",void 0),o=Pc(e,"actionMask",void 0),l=Pc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Pc(e,"space.icon",0),top:Pc(e,"space.iconTop",0),bottom:Pc(e,"space.iconBottom",0),left:Pc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Pc(e,"space.icon",0),left:Pc(e,"space.iconLeft",0),right:Pc(e,"space.iconRight",0),top:Pc(e,"space.iconTop",0)});var d=Pc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=el.call(this,r,r,1)),!d){var c=Pc(e,"iconSize",void 0);this.setIconSize(Pc(e,"iconWidth",c),Pc(e,"iconHeight",c))}}if(h){var u=Pc(e,"wrapText",!1),p=Pc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(hl(t)){case 0:switch("string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ll;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,yc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Oc(e,"minWidth",0),s=Oc(e,"minHeight",0),r=Oc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return xc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),xc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Pc(e,"space.text",0),m=Pc(e,"expandTextWidth",!1),y=Pc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Pc(e,"space.actionTop",0),bottom:Pc(e,"space.actionBottom",0),right:Pc(e,"space.actionRight",0)}:{left:Pc(e,"space.actionLeft",0),right:Pc(e,"space.actionRight",0),bottom:Pc(e,"space.actionBottom",0)},d=Pc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=el.call(this,a,a,1)),!d)){var b=Pc(e,"actionSize");this.setActionSize(Pc(e,"actionWidth",b),Pc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const _c=Phaser.GameObjects.Text,kc=Phaser.Utils.Objects.GetValue;class Ec extends _c{constructor(t,e){void 0===e&&(e={}),super(t,kc(e,"x",0),kc(e,"y",0),kc(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Ec.prototype,ca);var Mc=Phaser.Renderer.WebGL.Utils,Rc={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Mc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Lc=Phaser.Display.Canvas.CanvasPool;e();const Dc=Phaser.GameObjects.GameObject;class Ac extends Dc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Lc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Lc.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rextweaker.js b/dist/rextweaker.js index edf99234d2..7709e8e612 100644 --- a/dist/rextweaker.js +++ b/dist/rextweaker.js @@ -12210,7 +12210,7 @@ var LayoutChildren$5 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -12236,8 +12236,8 @@ continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -12266,10 +12266,10 @@ // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -12279,14 +12279,17 @@ width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -12484,6 +12487,7 @@ childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$2.call(this, gameObject); @@ -12509,6 +12513,9 @@ } fitRatio = GetValue$1E(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$1E(config, 'offsetX', 0); + offsetY = GetValue$1E(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -12549,12 +12556,21 @@ fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); @@ -35973,6 +35989,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index 9cde38cb13..10ef77b997 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -1,4 +1,4 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},E={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Re={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Be=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class wi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Pi(t,h):r.resetFromJSON(h),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Pi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Ei(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Pi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Di),Ai.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Ii extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ji[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ji={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ki extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Bs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Bs,zs,Ws);const js=Phaser.Utils.Objects.GetValue;class Ys extends ti{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Is);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Fs(e):t};class Xs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;let Vs=class extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Us extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Ks extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Zs=function(t,e){Xi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ks(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),a=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=Js.popUp;break;case ir.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Js.scaleDown;break;case ir.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ar={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Qs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var wr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new xr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!kr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Mr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ls{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Br=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=an,this.state=nn);break;case an:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=an))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=an:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&(this.state=rn)}get isTapped(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class on extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=wn}onDragEnd(){this.state=Cn}onDrag(){this.state===wn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=Cn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",wn="BEGIN",Sn="RECOGNIZED",kn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(kn(e,"inputConfig",void 0)),this.setEventEmitter(kn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(kn(t,"enable",!0)),this.bounds=kn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Rn:this.tracerState=En,this.onDrag1End();break;case Ln:this.tracerState=Rn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Mn.x=e.x-i.x,Mn.y=e.y-i.y}else Mn.x=0,Mn.y=0;return Mn}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(_n.prototype,Ue);var Mn={};const En=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Bn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},zn={};const Wn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Yn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=In(Yn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Un=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Un(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Ir.call(t,e),Fr.call(t,e),Vr.call(t,e),$r.call(t,e),Nn.call(t,e),Kn.call(t,e),qn.call(t,e),t},ta={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const la=Phaser.Utils.Objects.IsPlainObject,da=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,ua={min:0,full:-1};var pa=function(t,e,i,s,r,n,a,h,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ua[e];else if(la(e)){var u;e=da(u=e,"proportion",void 0),i=da(u,"align",ca),s=da(u,"padding",0),r=da(u,"expand",!1),n=da(u,"key",void 0),a=da(u,"index",void 0),t.isRexSizer||(h=da(u,"minWidth",void 0),o=da(u,"minHeight",void 0)),l=da(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ca),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},va={add:pa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),pa.call(this,new ha(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return la(i)&&(i.index=t),pa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=oa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ga=Mt.prototype.clear;var fa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ga.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fa.call(this,t),this}},ba={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ca={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},wa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,je.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&na.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&na.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Sa,va,ya,ba,xa,Ca,wa);var ka=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pa=function(t){return"string"==typeof t&&(t=Oa[t]),t};const Ta=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ma extends ia{constructor(t,e,i,s,r,n,a){Ta(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Pa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ka.call(this)),this._childrenProportion}}Object.assign(Ma.prototype,Sa);var Ea=function(t,e,i,s){return e/t<=i?e/(s-1):0},Ra=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=La(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=La(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Aa=Phaser.Utils.Objects.IsPlainObject,Ba=Phaser.Utils.Objects.GetValue,za=Phaser.Display.Align.CENTER;var Wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Aa(e)&&(e=Ba(r=e,"padding",0),i=Ba(r,"key",void 0),s=Ba(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=za,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Ia={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fa.call(this,t),this}},Fa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},gh=0,fh=1,mh=2,yh=0,bh=1,xh=2,Ch=/(?:\r\n|\r|\n)/;const wh={none:yh,word:bh,char:xh,character:xh,mix:3},Sh=Phaser.Renderer.WebGL.Utils;var kh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Oh=Phaser.Display.Color;var Ph={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Oh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Th=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},_h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Th(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Mh=Phaser.Display.Canvas.CanvasPool,Eh=Phaser.GameObjects.GameObject,Rh=Phaser.Utils.String.UUID;let Lh=class extends Eh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Mh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Rh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Mh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Dh=Phaser.GameObjects.Components;Phaser.Class.mixin(Lh,[Dh.Alpha,Dh.BlendMode,Dh.Crop,Dh.Depth,Dh.Flip,Dh.GetBounds,Dh.Mask,Dh.Origin,Dh.Pipeline,Dh.PostPipeline,Dh.ScrollFactor,Dh.Tint,Dh.Transform,Dh.Visible,kh,Ph,_h]);var Ah={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class Bh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Bh.prototype,Ah);var zh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Wh=Phaser.Math.RotateAround;var Ih;const jh=Phaser.Geom.Rectangle;var Yh,Fh=function(t){void 0===Yh&&(Yh=new jh);var e=t.drawTLX,i=t.drawTLY;return Yh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yh};const Xh=Phaser.Math.RotateAround;var Hh,Vh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hh&&(Hh={}),s=Hh),s.x=e,s.y=i,0!==t.rotation&&Xh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Gh=Phaser.GameObjects.Components.TransformMatrix;var Uh,Nh,$h={},Kh=function(t,e,i,s,r){var n=Vh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=$h);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Uh&&(Uh=new Gh,Nh=new Gh),t.parentContainer?t.getWorldTransformMatrix(Uh,Nh):Uh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Uh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Jh=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Kh(t,e,n,a,r)},qh={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ih&&(Ih={}),s=Ih),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wh(s,0,0,-i.rotation),s}(t,e,this,!0);return Fh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Jh(this.parent,this,t,e,i)}};Object.assign(qh,zh);const Zh=Phaser.Math.DegToRad,Qh=Phaser.Math.RadToDeg,to=Phaser.Utils.Objects.GetValue;class eo extends Bh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Qh(this._rotation)}set angle(t){this.rotation=Zh(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=to(t,"width",void 0),i=to(t,"height",void 0),s=to(t,"scaleX",void 0),r=to(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(eo.prototype,qh);const io=Phaser.Utils.String.Pad;var so=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${io(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ro=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const no=Phaser.Utils.Objects.GetValue;let ao=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=no(t,"x",0),i=no(t,"y",0));var s=this.cornerRadius;s.tl=ho(no(t,"tl",void 0),e,i),s.tr=ho(no(t,"tr",void 0),e,i),s.bl=ho(no(t,"bl",void 0),e,i),s.br=ho(no(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oo(this.cornerRadius.br,t)}};var ho=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),lo(t),t},oo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=no(e,"x",0),t.y=no(e,"y",0)),lo(t)},lo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const co=Phaser.Math.DegToRad;var uo=function(t){return!t.hasOwnProperty("convex")||t.convex},po=function(t){return t.x>0&&t.y>0},vo=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,l,o,l,180,270,!1,a):vo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,l,o,l,270,360,!1,a):vo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,r-l,o,l,0,90,!1,a):vo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,r-l,o,l,90,180,!1,a):vo(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},fo=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),go(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const mo=Phaser.Utils.Objects.GetValue;class yo extends eo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(mo(e,"color",null),mo(e,"color2",null),mo(e,"horizontalGradient",!0)),this.setStroke(mo(e,"stroke",null),mo(e,"strokeThickness",2)),this.setCornerRadius(mo(e,"cornerRadius",0),mo(e,"cornerIteration",null))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=so(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ro("color2",t,this),ro("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ro("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ro("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){fo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const bo=Phaser.Utils.Objects.GetValue;class xo extends eo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(bo(e,"color",null),bo(e,"color2",null),bo(e,"horizontalGradient",!0)),this.setStroke(bo(e,"stroke",null),bo(e,"strokeThickness",2))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=so(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,bo(t,"color2",null),bo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,bo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const Co=Phaser.Utils.Objects.GetValue;let wo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Co(t,"bold",!1)),this.setItalic(Co(t,"italic",!1)),this.setFontSize(Co(t,"fontSize","16px")),this.setFontFamily(Co(t,"fontFamily","Courier")),this.setColor(Co(t,"color","#fff")),this.setStrokeStyle(Co(t,"stroke",null),Co(t,"strokeThickness",0)),this.setShadow(Co(t,"shadowColor",null),Co(t,"shadowOffsetX",0),Co(t,"shadowOffsetY",0),Co(t,"shadowBlur",0)),this.setOffset(Co(t,"offsetX",0),Co(t,"offsetY",0)),this.setSpace(Co(t,"leftSpace",0),Co(t,"rightSpace",0)),this.setAlign(Co(t,"align",void 0)),this.setBackgroundColor(Co(t,"backgroundColor",null)),this.setBackgroundHeight(Co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Co(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ro("stroke",t,this),ro("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ro("shadowOffsetX",t,this),ro("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=so(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=so(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=so(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=so(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const So=Phaser.Utils.Array.Remove,ko=Phaser.Utils.Array.Remove,Oo="text",Po="image",To="drawer",_o="space",Mo="command";var Eo=function(t){return t.type===Oo&&"\n"===t.text},Ro=function(t){return t.type===Oo&&"\f"===t.text},Lo=function(t){return t.type===Oo};class Do extends eo{constructor(t,e,i){super(t,Oo),this.updateTextFlag=!1,this.style=new wo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Bo=Phaser.Display.Canvas.CanvasPool;var zo=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Bo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Bo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Wo extends eo{constructor(t,e,i){super(t,Po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){zo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Io extends eo{constructor(t,e,i,s){super(t,To),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class jo extends eo{constructor(t,e){super(t,_o),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Yo extends Bh{constructor(t,e,i,s,r){super(t,Mo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Fo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Fo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}var Xo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ho={none:0,word:1,char:2,character:2,mix:3};var Vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=$o.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=$o.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Jo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Jo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Jo(t,"wrapMode");void 0===c&&(c=Jo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ho[c]);var u=Jo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Jo(t,"letterSpacing",0),v=Jo(t,"hAlign",0),g=Jo(t,"vAlign",0),f=Jo(t,"justifyPercentage",.25),m=Xo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Qo(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qo(t,"maxLines",0);var h=0===i,o=Qo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Qo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Qo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qo(t,"letterSpacing",0),p=Qo(t,"rtl",!0),v=Qo(t,"hAlign",p?2:0),g=Qo(t,"vAlign",0),f=Xo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),So(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ko(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Oo);return null===i?i=new Do(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Jh(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const kl=Phaser.Utils.Objects.GetFastValue;var Ol={};class Pl{constructor(t){this.pools=kl(t,"pools",Ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Al(t,r,e,i,n),h=0;h<=Rl&&0!==a;h++){if((r+=a)<0){r=0;break}a=Al(t,r,e,i,n)}return h===Rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bl(t,e,i),t},Dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Al=function(t,e,i,s,r){var n,a=Dl(t,e,r),h=Dl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Bl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Utils.Objects.GetValue;class Il extends Qa{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Wl(e,"background",void 0),r=Wl(e,"icon",void 0),n=Wl(e,"iconMask",void 0),a=Wl(e,"text",void 0),h=Wl(e,"action",void 0),o=Wl(e,"actionMask",void 0),l=Wl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Wl(e,"space.icon",0),top:Wl(e,"space.iconTop",0),bottom:Wl(e,"space.iconBottom",0),left:Wl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Wl(e,"space.icon",0),left:Wl(e,"space.iconLeft",0),right:Wl(e,"space.iconRight",0),top:Wl(e,"space.iconTop",0)});var d=Wl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=nh.call(this,r,r,1)),!d){var c=Wl(e,"iconSize",void 0);this.setIconSize(Wl(e,"iconWidth",c),Wl(e,"iconHeight",c))}}if(a){var u=Wl(e,"wrapText",!1),p=Wl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(dh(t)){case 0:switch("string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ph;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,El(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zl(e,"minWidth",0),s=zl(e,"minHeight",0),r=zl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=Wl(e,"space.text",0),m=Wl(e,"expandTextWidth",!1),y=Wl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:Wl(e,"space.actionTop",0),bottom:Wl(e,"space.actionBottom",0),right:Wl(e,"space.actionRight",0)}:{left:Wl(e,"space.actionLeft",0),right:Wl(e,"space.actionRight",0),bottom:Wl(e,"space.actionBottom",0)},d=Wl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=nh.call(this,h,h,1)),!d)){var b=Wl(e,"actionSize");this.setActionSize(Wl(e,"actionWidth",b),Wl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var jl=Phaser.Renderer.WebGL.Utils,Yl=function(t,e,i,s,r,n){for(var a=jl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Gl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ul=Phaser.Renderer.Canvas.SetTransform;var Nl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Yl(r,a,e,l,h,o),e.isStroked&&Xl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ul(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Kl.prototype,Nl);var Jl=function(t){return t.x>0&&t.y>0},ql=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Zl=Phaser.Math.DegToRad;var Ql=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=tc(t,"tl",0),this.radiusTR=tc(t,"tr",0),this.radiusBL=tc(t,"bl",0),this.radiusBR=tc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Ql(e,e,e,e,180,270,!1,r,t):Ql(0,0,e,e,90,0,!0,r,t):ql(0,0,t),(e=this.radiusTR)>0?this._convexTR?Ql(i-e,e,e,e,270,360,!1,r,t):Ql(i,0,e,e,180,90,!0,r,t):ql(i,0,t),(e=this.radiusBR)>0?this._convexBR?Ql(i-e,s-e,e,e,0,90,!1,r,t):Ql(i,s,e,e,270,180,!0,r,t):ql(i,s,t),(e=this.radiusBL)>0?this._convexBL?Ql(e,s-e,e,e,90,180,!1,r,t):Ql(0,s,e,e,360,270,!0,r,t):ql(0,s,t),t.push(t[0],t[1]),Wd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ic=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const sc=Phaser.Utils.Objects.GetValue,rc=Phaser.Utils.Objects.IsPlainObject;class nc extends(Td(bd)){constructor(t,e,i,s,r,n,a,h){rc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):rc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):rc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Qd).setName("trackFill")).addShape((new Qd).setName("bar")).addShape((new Qd).setName("trackStroke")),this.setTrackColor(sc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sc(h,"trackStrokeThickness",2),sc(h,"trackStrokeColor",void 0)),this.setSkewX(sc(h,"skewX",0)),this.setRTL(sc(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ac={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ic(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ic(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&ic(h,0,0,e,i,t)}};Object.assign(nc.prototype,ac);var hc=function(t){return null==t||""===t||0===t.length},oc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(hc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(hc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Pc(t)?(this.stretchMode.edge=_c(Tc(t,"edge",0)),this.stretchMode.internal=_c(Tc(t,"internal",0))):(t=_c(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ec.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lc=Phaser.Utils.Objects.IsPlainObject,Dc=Phaser.Utils.Objects.GetValue,Ac=Phaser.GameObjects;var Bc=void 0,zc=function(t,e){if(Bc||(Bc={},Ze(t).events.once("destroy",(function(){for(var t in Bc)Bc[t].destroy();Bc=void 0}))),!Bc.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ac[e](i)).setOrigin(0),Bc[e]=t}return Bc[e]};const Wc=Phaser.GameObjects.RenderTexture;class Ic extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Lc(i)?(i=Dc(d=i,"x",0),s=Dc(d,"y",0),r=Dc(d,"width",1),n=Dc(d,"height",1),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(r)?(r=Dc(d=r,"width",1),n=Dc(d,"height",1),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(a)?(a=Dc(d=a,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(h)?(h=Dc(d=h,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Dc(d,"baseFrame",void 0)):Lc(o)&&(o=Dc(d=o,"columns",void 0),l=Dc(d,"rows",void 0)),void 0===h&&(h=Dc(d,"frame",void 0)),void 0===o){var c=Dc(d,"leftWidth",void 0),u=Dc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Dc(d,"topHeight",void 0),v=Dc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Dc(d,"getFrameNameCallback",void 0)),this.setStretchMode(Dc(d,"stretchMode",0)),this.setPreserveRatio(Dc(d,"preserveRatio",!0));var g=Dc(d,"maxFixedPartScale",1),f=Dc(d,"maxFixedPartScaleX",g),m=Dc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Rc),i}(Wc,"rexNinePatch")){}var jc={_drawImage:function(t,e,i,s,r,n){var a=zc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=zc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ic.prototype,jc);let Yc=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(cc(t,e))return t[e];var i=t.parent;return cc(i,e)?i[e]:void 0}set(t,e,i){return cc(t,e)?t[e]=i:cc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Fc=Phaser.Utils.Objects.GetValue;class Xc extends Ic{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Fc(e,"effects",!0);i&&fc(this,i),this.style=new Yc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xc.prototype,cd);const Hc=["alpha","tint","flipX","flipY"];var Vc=function(t,e){if(!e)return t;for(var i=0,s=Hc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},E={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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};const Te=/(\S+)\[(\d+)\]/i,_e=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Ee=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Re={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},De=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Be=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class wi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Si=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var _i=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Pi(t,h):r.resetFromJSON(h),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Pi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Ei(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Pi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Di),Ai.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Ii extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ji[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const ji={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Yi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Xi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ki extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=is(i,"magnitude",void 0),t=is(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(us(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ei(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,fs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Bs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Bs,zs,Ws);const js=Phaser.Utils.Objects.GetValue;class Ys extends ti{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:js(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Is);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Fs(e):t};class Xs extends ti{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Hs=Phaser.GameObjects.Rectangle;let Vs=class extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Us extends ti{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Ks extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Zs=function(t,e){Xi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ks(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),a=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=Js.popUp;break;case ir.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Js.scaleDown;break;case ir.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ar={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Qs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var wr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new xr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!kr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends ti{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Mr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ls{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Br=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=an,this.state=nn);break;case an:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=an))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=an:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&(this.state=rn)}get isTapped(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class on extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=wn}onDragEnd(){this.state=Cn}onDrag(){this.state===wn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=Cn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",wn="BEGIN",Sn="RECOGNIZED",kn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(kn(e,"inputConfig",void 0)),this.setEventEmitter(kn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(kn(t,"enable",!0)),this.bounds=kn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],On(this.pointers,e),this.tracerState){case Rn:this.tracerState=En,this.onDrag1End();break;case Ln:this.tracerState=Rn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Mn.x=e.x-i.x,Mn.y=e.y-i.y}else Mn.x=0,Mn.y=0;return Mn}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Ln)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(_n.prototype,Ue);var Mn={};const En=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Bn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},zn={};const Wn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Xn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=zn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Yn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=In(Yn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Un=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Un(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Ir.call(t,e),Fr.call(t,e),Vr.call(t,e),$r.call(t,e),Nn.call(t,e),Kn.call(t,e),qn.call(t,e),t},ta={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",de),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const la=Phaser.Utils.Objects.IsPlainObject,da=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,ua={min:0,full:-1};var pa=function(t,e,i,s,r,n,a,h,o,l,d,c){ge.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=ua[e];else if(la(e)){var v;e=da(v=e,"proportion",void 0),i=da(v,"align",ca),s=da(v,"padding",0),r=da(v,"expand",!1),n=da(v,"key",void 0),a=da(v,"index",void 0),t.isRexSizer||(h=da(v,"minWidth",void 0),o=da(v,"minHeight",void 0)),l=da(v,"fitRatio",0),d=da(v,"offsetX",0),c=da(v,"offsetY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=ca),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=pe(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=d,v.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},va={add:pa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),pa.call(this,new ha(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return la(i)&&(i.index=t),pa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=oa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ga=Mt.prototype.clear;var fa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ga.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fa.call(this,t),this}},ba={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ca={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},wa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,je.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&na.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&na.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Sa,va,ya,ba,xa,Ca,wa);var ka=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Oa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pa=function(t){return"string"==typeof t&&(t=Oa[t]),t};const Ta=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ma extends ia{constructor(t,e,i,s,r,n,a){Ta(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Pa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=ka.call(this)),this._childrenProportion}}Object.assign(Ma.prototype,Sa);var Ea=function(t,e,i,s){return e/t<=i?e/(s-1):0},Ra=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=La(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=La(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Aa=Phaser.Utils.Objects.IsPlainObject,Ba=Phaser.Utils.Objects.GetValue,za=Phaser.Display.Align.CENTER;var Wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Aa(e)&&(e=Ba(r=e,"padding",0),i=Ba(r,"key",void 0),s=Ba(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=za,r.padding=pe(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},Ia={add(t,e,i){if(dr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,fa.call(this,t),this}},Fa={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},gh=0,fh=1,mh=2,yh=0,bh=1,xh=2,Ch=/(?:\r\n|\r|\n)/;const wh={none:yh,word:bh,char:xh,character:xh,mix:3},Sh=Phaser.Renderer.WebGL.Utils;var kh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Sh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Oh=Phaser.Display.Color;var Ph={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Oh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Th=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},_h={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Th(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Mh=Phaser.Display.Canvas.CanvasPool,Eh=Phaser.GameObjects.GameObject,Rh=Phaser.Utils.String.UUID;let Lh=class extends Eh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Mh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Rh(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Mh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Dh=Phaser.GameObjects.Components;Phaser.Class.mixin(Lh,[Dh.Alpha,Dh.BlendMode,Dh.Crop,Dh.Depth,Dh.Flip,Dh.GetBounds,Dh.Mask,Dh.Origin,Dh.Pipeline,Dh.PostPipeline,Dh.ScrollFactor,Dh.Tint,Dh.Transform,Dh.Visible,kh,Ph,_h]);var Ah={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class Bh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Bh.prototype,Ah);var zh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Wh=Phaser.Math.RotateAround;var Ih;const jh=Phaser.Geom.Rectangle;var Yh,Fh=function(t){void 0===Yh&&(Yh=new jh);var e=t.drawTLX,i=t.drawTLY;return Yh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yh};const Xh=Phaser.Math.RotateAround;var Hh,Vh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hh&&(Hh={}),s=Hh),s.x=e,s.y=i,0!==t.rotation&&Xh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Gh=Phaser.GameObjects.Components.TransformMatrix;var Uh,Nh,$h={},Kh=function(t,e,i,s,r){var n=Vh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=$h);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Uh&&(Uh=new Gh,Nh=new Gh),t.parentContainer?t.getWorldTransformMatrix(Uh,Nh):Uh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Uh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Jh=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Kh(t,e,n,a,r)},qh={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ih&&(Ih={}),s=Ih),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wh(s,0,0,-i.rotation),s}(t,e,this,!0);return Fh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Jh(this.parent,this,t,e,i)}};Object.assign(qh,zh);const Zh=Phaser.Math.DegToRad,Qh=Phaser.Math.RadToDeg,to=Phaser.Utils.Objects.GetValue;class eo extends Bh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Qh(this._rotation)}set angle(t){this.rotation=Zh(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=to(t,"width",void 0),i=to(t,"height",void 0),s=to(t,"scaleX",void 0),r=to(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(eo.prototype,qh);const io=Phaser.Utils.String.Pad;var so=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${io(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ro=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const no=Phaser.Utils.Objects.GetValue;let ao=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=no(t,"x",0),i=no(t,"y",0));var s=this.cornerRadius;s.tl=ho(no(t,"tl",void 0),e,i),s.tr=ho(no(t,"tr",void 0),e,i),s.bl=ho(no(t,"bl",void 0),e,i),s.br=ho(no(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oo(this.cornerRadius.br,t)}};var ho=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),lo(t),t},oo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=no(e,"x",0),t.y=no(e,"y",0)),lo(t)},lo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const co=Phaser.Math.DegToRad;var uo=function(t){return!t.hasOwnProperty("convex")||t.convex},po=function(t){return t.x>0&&t.y>0},vo=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,l,o,l,180,270,!1,a):vo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,l,o,l,270,360,!1,a):vo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,r-l,o,l,0,90,!1,a):vo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,r-l,o,l,90,180,!1,a):vo(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},fo=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),go(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const mo=Phaser.Utils.Objects.GetValue;class yo extends eo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(mo(e,"color",null),mo(e,"color2",null),mo(e,"horizontalGradient",!0)),this.setStroke(mo(e,"stroke",null),mo(e,"strokeThickness",2)),this.setCornerRadius(mo(e,"cornerRadius",0),mo(e,"cornerIteration",null))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=so(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ro("color2",t,this),ro("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ro("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ro("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){fo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const bo=Phaser.Utils.Objects.GetValue;class xo extends eo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(bo(e,"color",null),bo(e,"color2",null),bo(e,"horizontalGradient",!0)),this.setStroke(bo(e,"stroke",null),bo(e,"strokeThickness",2))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=so(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,bo(t,"color2",null),bo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,bo(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const Co=Phaser.Utils.Objects.GetValue;let wo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Co(t,"bold",!1)),this.setItalic(Co(t,"italic",!1)),this.setFontSize(Co(t,"fontSize","16px")),this.setFontFamily(Co(t,"fontFamily","Courier")),this.setColor(Co(t,"color","#fff")),this.setStrokeStyle(Co(t,"stroke",null),Co(t,"strokeThickness",0)),this.setShadow(Co(t,"shadowColor",null),Co(t,"shadowOffsetX",0),Co(t,"shadowOffsetY",0),Co(t,"shadowBlur",0)),this.setOffset(Co(t,"offsetX",0),Co(t,"offsetY",0)),this.setSpace(Co(t,"leftSpace",0),Co(t,"rightSpace",0)),this.setAlign(Co(t,"align",void 0)),this.setBackgroundColor(Co(t,"backgroundColor",null)),this.setBackgroundHeight(Co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Co(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ro("stroke",t,this),ro("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ro("shadowOffsetX",t,this),ro("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=so(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=so(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=so(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=so(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const So=Phaser.Utils.Array.Remove,ko=Phaser.Utils.Array.Remove,Oo="text",Po="image",To="drawer",_o="space",Mo="command";var Eo=function(t){return t.type===Oo&&"\n"===t.text},Ro=function(t){return t.type===Oo&&"\f"===t.text},Lo=function(t){return t.type===Oo};class Do extends eo{constructor(t,e,i){super(t,Oo),this.updateTextFlag=!1,this.style=new wo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Bo=Phaser.Display.Canvas.CanvasPool;var zo=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Bo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Bo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Wo extends eo{constructor(t,e,i){super(t,Po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){zo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Io extends eo{constructor(t,e,i,s){super(t,To),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class jo extends eo{constructor(t,e){super(t,_o),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Yo extends Bh{constructor(t,e,i,s,r){super(t,Mo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function Fo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Fo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}var Xo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Ho={none:0,word:1,char:2,character:2,mix:3};var Vo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=$o.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=$o.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Jo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Jo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Jo(t,"wrapMode");void 0===c&&(c=Jo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ho[c]);var u=Jo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Jo(t,"letterSpacing",0),v=Jo(t,"hAlign",0),g=Jo(t,"vAlign",0),f=Jo(t,"justifyPercentage",.25),m=Xo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Qo(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qo(t,"maxLines",0);var h=0===i,o=Qo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Qo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Qo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qo(t,"letterSpacing",0),p=Qo(t,"rtl",!0),v=Qo(t,"hAlign",p?2:0),g=Qo(t,"vAlign",0),f=Xo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Me(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),So(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ko(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Oo);return null===i?i=new Do(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Jh(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const kl=Phaser.Utils.Objects.GetFastValue;var Ol={};class Pl{constructor(t){this.pools=kl(t,"pools",Ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Al(t,r,e,i,n),h=0;h<=Rl&&0!==a;h++){if((r+=a)<0){r=0;break}a=Al(t,r,e,i,n)}return h===Rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bl(t,e,i),t},Dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Al=function(t,e,i,s,r){var n,a=Dl(t,e,r),h=Dl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Bl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Utils.Objects.GetValue;class Il extends Qa{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Wl(e,"background",void 0),r=Wl(e,"icon",void 0),n=Wl(e,"iconMask",void 0),a=Wl(e,"text",void 0),h=Wl(e,"action",void 0),o=Wl(e,"actionMask",void 0),l=Wl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Wl(e,"space.icon",0),top:Wl(e,"space.iconTop",0),bottom:Wl(e,"space.iconBottom",0),left:Wl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Wl(e,"space.icon",0),left:Wl(e,"space.iconLeft",0),right:Wl(e,"space.iconRight",0),top:Wl(e,"space.iconTop",0)});var d=Wl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=nh.call(this,r,r,1)),!d){var c=Wl(e,"iconSize",void 0);this.setIconSize(Wl(e,"iconWidth",c),Wl(e,"iconHeight",c))}}if(a){var u=Wl(e,"wrapText",!1),p=Wl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(dh(t)){case 0:switch("string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ph;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,El(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zl(e,"minWidth",0),s=zl(e,"minHeight",0),r=zl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=Wl(e,"space.text",0),m=Wl(e,"expandTextWidth",!1),y=Wl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:Wl(e,"space.actionTop",0),bottom:Wl(e,"space.actionBottom",0),right:Wl(e,"space.actionRight",0)}:{left:Wl(e,"space.actionLeft",0),right:Wl(e,"space.actionRight",0),bottom:Wl(e,"space.actionBottom",0)},d=Wl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=nh.call(this,h,h,1)),!d)){var b=Wl(e,"actionSize");this.setActionSize(Wl(e,"actionWidth",b),Wl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var jl=Phaser.Renderer.WebGL.Utils,Yl=function(t,e,i,s,r,n){for(var a=jl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Gl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ul=Phaser.Renderer.Canvas.SetTransform;var Nl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Yl(r,a,e,l,h,o),e.isStroked&&Xl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ul(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Kl.prototype,Nl);var Jl=function(t){return t.x>0&&t.y>0},ql=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Zl=Phaser.Math.DegToRad;var Ql=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=tc(t,"tl",0),this.radiusTR=tc(t,"tr",0),this.radiusBL=tc(t,"bl",0),this.radiusBR=tc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Ql(e,e,e,e,180,270,!1,r,t):Ql(0,0,e,e,90,0,!0,r,t):ql(0,0,t),(e=this.radiusTR)>0?this._convexTR?Ql(i-e,e,e,e,270,360,!1,r,t):Ql(i,0,e,e,180,90,!0,r,t):ql(i,0,t),(e=this.radiusBR)>0?this._convexBR?Ql(i-e,s-e,e,e,0,90,!1,r,t):Ql(i,s,e,e,270,180,!0,r,t):ql(i,s,t),(e=this.radiusBL)>0?this._convexBL?Ql(e,s-e,e,e,90,180,!1,r,t):Ql(0,s,e,e,360,270,!0,r,t):ql(0,s,t),t.push(t[0],t[1]),Wd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ic=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const sc=Phaser.Utils.Objects.GetValue,rc=Phaser.Utils.Objects.IsPlainObject;class nc extends(Td(bd)){constructor(t,e,i,s,r,n,a,h){rc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):rc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):rc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Qd).setName("trackFill")).addShape((new Qd).setName("bar")).addShape((new Qd).setName("trackStroke")),this.setTrackColor(sc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sc(h,"trackStrokeThickness",2),sc(h,"trackStrokeColor",void 0)),this.setSkewX(sc(h,"skewX",0)),this.setRTL(sc(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ac={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ic(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ic(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&ic(h,0,0,e,i,t)}};Object.assign(nc.prototype,ac);var hc=function(t){return null==t||""===t||0===t.length},oc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(hc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(hc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Pc(t)?(this.stretchMode.edge=_c(Tc(t,"edge",0)),this.stretchMode.internal=_c(Tc(t,"internal",0))):(t=_c(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ec.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Lc=Phaser.Utils.Objects.IsPlainObject,Dc=Phaser.Utils.Objects.GetValue,Ac=Phaser.GameObjects;var Bc=void 0,zc=function(t,e){if(Bc||(Bc={},Ze(t).events.once("destroy",(function(){for(var t in Bc)Bc[t].destroy();Bc=void 0}))),!Bc.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ac[e](i)).setOrigin(0),Bc[e]=t}return Bc[e]};const Wc=Phaser.GameObjects.RenderTexture;class Ic extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Lc(i)?(i=Dc(d=i,"x",0),s=Dc(d,"y",0),r=Dc(d,"width",1),n=Dc(d,"height",1),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(r)?(r=Dc(d=r,"width",1),n=Dc(d,"height",1),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(a)?(a=Dc(d=a,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(h)?(h=Dc(d=h,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Dc(d,"baseFrame",void 0)):Lc(o)&&(o=Dc(d=o,"columns",void 0),l=Dc(d,"rows",void 0)),void 0===h&&(h=Dc(d,"frame",void 0)),void 0===o){var c=Dc(d,"leftWidth",void 0),u=Dc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Dc(d,"topHeight",void 0),v=Dc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Dc(d,"getFrameNameCallback",void 0)),this.setStretchMode(Dc(d,"stretchMode",0)),this.setPreserveRatio(Dc(d,"preserveRatio",!0));var g=Dc(d,"maxFixedPartScale",1),f=Dc(d,"maxFixedPartScaleX",g),m=Dc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Rc),i}(Wc,"rexNinePatch")){}var jc={_drawImage:function(t,e,i,s,r,n){var a=zc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=zc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ic.prototype,jc);let Yc=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(cc(t,e))return t[e];var i=t.parent;return cc(i,e)?i[e]:void 0}set(t,e,i){return cc(t,e)?t[e]=i:cc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Fc=Phaser.Utils.Objects.GetValue;class Xc extends Ic{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Fc(e,"effects",!0);i&&fc(this,i),this.style=new Yc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xc.prototype,cd);const Hc=["alpha","tint","flipX","flipY"];var Vc=function(t,e){if(!e)return t;for(var i=0,s=Hc.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexuiplugin.js b/dist/rexuiplugin.js index 1b9549945a..a32e56fb9d 100644 --- a/dist/rexuiplugin.js +++ b/dist/rexuiplugin.js @@ -41950,6 +41950,7 @@ minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } @@ -47629,7 +47630,7 @@ void main () { var LayoutChildren$4 = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -47655,8 +47656,8 @@ void main () { continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -47685,10 +47686,10 @@ void main () { // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -47698,14 +47699,17 @@ void main () { width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); @@ -47903,6 +47907,7 @@ void main () { childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild$1.call(this, gameObject); @@ -47928,6 +47933,9 @@ void main () { } fitRatio = GetValue$23(config, 'fitRatio', 0); // width/height + + offsetX = GetValue$23(config, 'offsetX', 0); + offsetY = GetValue$23(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -47968,12 +47976,21 @@ void main () { fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/dist/rexuiplugin.min.js b/dist/rexuiplugin.min.js index f5dce0596f..de741544e7 100644 --- a/dist/rexuiplugin.min.js +++ b/dist/rexuiplugin.min.js @@ -3,7 +3,7 @@ var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,t.events.once( * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Se=Phaser.Display.Canvas.CanvasPool;var Pe=function(t){var e=Se.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Se.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,Se.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Ee&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Be[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Pe(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Jt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Jt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Be[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var Ae=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Fe=Phaser.Utils.Objects.GetValue,Ye=Te,Xe=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xe&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ye&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xe&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ve=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ne({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var gs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Yi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Os.prototype,Z);var Ms={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,js=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const As=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=js(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ys);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new As,Fs=new As),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Xs(t,e,n,a,r)},Vs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Hs(this._rotation)}set angle(t){this.rotation=Gs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Qs=Phaser.Utils.Objects.GetValue;class tr{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Jt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let mr=class extends Ns{constructor(t,e){super(t,ar),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const kr={none:0,word:1,char:2,character:2,mix:3};var wr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),er(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sr);return null===i?i=new ur(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ws(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cn),function(t){if(t.events)return t;var e=new xn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mn(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},An=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Yn=Phaser.Math.Vector2,Xn=Phaser.Math.RotateAround;var Wn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Vn&&(Vn=new Fn),e=Vn),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Gn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Hn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Gn(t,e),i=e.x,s=e.y,Hn(t,e),r=e.x,n=e.y,Un(t,e),a=e.x,o=e.y,Nn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Vn=void 0,Gn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopRight?t.getTopRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},$n=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn);var s=An(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Jn(t,e,i)},Kn=void 0,Jn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Xn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=qn(i,"color"),r=qn(i,"lineWidth"),n=qn(i,"fillColor"),a=qn(i,"fillAlpha",1),o=qn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Va:Wa,this.repeatCounter=0,this}stop(){return this.state=Xa,this}update(t,e){this.state!==Xa&&this.state!==Ha&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ga)):(this.nowTime=this.duration,this.state=Ha):this.nowTime>=0&&(this.state=Va))}get t(){var t;switch(this.state){case Xa:case Wa:case Ga:t=0;break;case Va:t=this.nowTime/this.duration;break;case Ha:t=1}return Fa(t,0,1)}set t(t){(t=Fa(t,-1,1))<0?(this.state=Wa,this.nowTime=-this.delay*t):(this.state=Va,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Xa}get isDelay(){return this.state===Wa}get isCountDown(){return this.state===Va}get isRunning(){return this.state===Wa||this.state===Va}get isDone(){return this.state===Ha}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Xa=0,Wa=1,Va=2,Ga=3,Ha=-1;class Ua extends ja{constructor(t,e){super(t,e),this.timer=new Ya}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Na=Phaser.Utils.Objects.GetValue,$a=Phaser.Utils.Objects.GetAdvancedValue,Ka=Phaser.Tweens.Builders.GetEaseFunction;class Ja extends Ua{resetFromJSON(t){return this.timer.resetFromJSON(Na(t,"timer")),this.setEnable(Na(t,"enable",!0)),this.setTarget(Na(t,"target",this.parent)),this.setDelay($a(t,"delay",0)),this.setDuration($a(t,"duration",1e3)),this.setEase(Na(t,"ease","Linear")),this.setRepeat(Na(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ka(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const qa=Phaser.Sound.BaseSound;var Za=function(t){return t instanceof qa};const Qa=Phaser.Utils.Objects.GetValue,to=Phaser.Utils.Objects.GetAdvancedValue,eo=Phaser.Math.Linear;let io=class extends Ja{constructor(t,e,i){Za(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Qa(t,"mode",0)),this.setEnable(Qa(t,"enable",!0)),this.setVolumeRange(to(t,"volume.start",this.parent.volume),to(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=so[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=eo(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const so={stop:1,destroy:2};var ro=function(t,e,i,s,r){Za(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new io(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},no=function(t,e,i,s){Za(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new io(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ao=Phaser.Utils.Objects.GetValue;var oo={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ao(e,"loop",this.backgroundMusicLoop),mute:ao(e,"mute",this.backgroundMusicMute),volume:ao(e,"volume",this.backgroundMusicVolume),detune:ao(e,"detune",0),rate:ao(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ro(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&no(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ho=Phaser.Utils.Objects.GetValue;var lo={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusic2Mute),volume:ho(e,"volume",this.backgroundMusic2Volume),detune:ho(e,"detune",0),rate:ho(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ro(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&no(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const co=Phaser.Utils.Array.Remove,uo=Phaser.Utils.Objects.GetValue;var po={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:uo(e,"mute",this.soundEffectsMute),volume:uo(e,"volume",this.soundEffectsVolume),detune:uo(e,"detune",0),rate:uo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&co(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&co(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ro(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&no(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)no(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ro(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&no(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)no(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=qo:t||(t=Qo),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=eh),this.tagExpression=t,this}setValueExpression(t){return t||(t=eh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==eh||this.valueExpression!==eh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=qo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:al,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===sr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,ol.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},hl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},ll=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},dl=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const cl=Phaser.Input.Keyboard.KeyCodes;var ul=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Ol=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const _l=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Pl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Tl,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Pl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,Ml,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);xr.call(t,`${s}.chain`,El,[s,r,a],t),e.skipEvent()}}}))}];var Rl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=_l,t.createGameObject=Cl(t.createGameObject),this.addGameObjectManager(t,Sl)},Ll=function(t,e){return 2===t.length&&t[0]===e},Bl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Dl=function(t){this.getGameObjectManager(t).removeAll()},jl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Al={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},zl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Fl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ll(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Bl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ll(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Il,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Dl,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],xr.call(t,`${s}.call`,jl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Al[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,zl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Yl=Wo.addGameObjectManager;var Xl={addGameObjectManager(t,e){(t=t?Ve(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Yl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Fl]:Fl).length;a0)return nd.length=0,!0;return nd.length=0,!1},nd=[],ad=void 0;const od=Phaser.Utils.Objects.GetValue;var hd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=od(e,n,s[1]))&&(i[s[0]]=r);return i},ld=function(t){t.addEventListener("touchstart",dd,!1),t.addEventListener("touchmove",dd,!1),t.addEventListener("touchend",dd,!1),t.addEventListener("mousedown",dd,!1),t.addEventListener("mouseup",dd,!1),t.addEventListener("mousemove",dd,!1)},dd=function(t){t.stopPropagation()},cd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},ud=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",cd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(xa.call(this.clickOutSideTarget,this.parent),ba.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},pd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",cd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const gd=Phaser.Utils.Objects.GetValue;var vd=function(t,e){var i,s=gd(e,"inputType",void 0);void 0===s&&(s=gd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=gd(e,"style",void 0),n=i.style;hd(ed,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",hd(td,e,i),ld(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){ud.call(t)})),i.addEventListener("blur",(function(e){pd.call(t)})),i},fd={open:function(){return this.isOpened||this.readOnly||((t=this)!==ad&&(void 0!==ad&&ad.close(),ad=t),this.node||(this.node=vd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===ad&&(ad=void 0),this.setBlur(),this):this}};const md=Phaser.Utils.Objects.GetValue;class yd extends Ra{constructor(t,e){super(t);var i=md(e,"inputType",void 0);void 0===i&&(i=md(e,"type","text")),this.setEnterCloseEnable(md(e,"enterClose","textarea"!==i));var s=md(e,"onOpen",void 0);s||(s=md(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=md(e,"clickOutSideTarget",void 0);var r=md(e,"onClose",void 0);r||(r=md(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=md(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return id(t,e,"inputType"),id(t,e,"type"),id(t,e,"style"),id(t,e,ed),id(t,e,td),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){sd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(yd.prototype,fd);var bd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},xd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(xd(this),Cd(this)),this}setNumberInput(){return this.onUpdateCallback=bd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Sd=Phaser.Utils.Objects.GetValue,Pd=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Td=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ed=Phaser.GameObjects.Zone;let _d=class extends Ed{constructor(t){super(t,0,0,2,2),this.fullWindow=new Md(this)}};var Rd=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Ld=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Bd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Ad.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(zd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Fd=new Ad,Yd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Xd=/\S/,Wd=new Ad;Wd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Xd.test(t)&&!Xd.test(e)},Wd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Ud(t,null,null,i),i," ")},Hd.equals=function(t,e){return Ad.prototype.equals.call(Hd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nd=new Ad;Nd.tokenize=function(t){return t.slice()},Nd.join=Nd.removeEmpty=function(t){return t};const $d=Phaser.Utils.Array.Remove;var Kd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$d(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Fd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},tc={cursorMoveLeft(){if(!this.isOpened)return this;var t=qd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=qd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ec=Phaser.Utils.Objects.IsPlainObject;class ic extends hn{constructor(t,e,i,s,r,n){ec(e)?n=e:ec(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Td(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Td(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Td(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Td(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Td(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new _d(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Rd(n.background,"focus"),h=Rd(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Sd(e,"edit");return void 0===i&&(i={}),id(e,i,Pd),new wd(t,i)}(this,n),Ld.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Dd.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=$c(t,"tl",0),this.radiusTR=$c(t,"tr",0),this.radiusBL=$c(t,"bl",0),this.radiusBR=$c(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Lt(e,e,e,e,180,270,!1,r,t):Lt(0,0,e,e,90,0,!0,r,t):_t(0,0,t),(e=this.radiusTR)>0?this._convexTR?Lt(i-e,e,e,e,270,360,!1,r,t):Lt(i,0,e,e,180,90,!0,r,t):_t(i,0,t),(e=this.radiusBR)>0?this._convexBR?Lt(i-e,s-e,e,e,0,90,!1,r,t):Lt(i,s,e,e,270,180,!0,r,t):_t(i,s,t),(e=this.radiusBL)>0?this._convexBL?Lt(e,s-e,e,e,90,180,!1,r,t):Lt(0,s,e,e,360,270,!0,r,t):_t(0,s,t),t.push(t[0],t[1]),Ec(this.x,this.y,t),super.updateData(),this}}const Jc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var qc={buildShapes(){this.addShape((new Kc).setName("box")).addShape((new Uc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Math.Linear;class tu extends Ja{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Zc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Zc(t,"from",i),this.toValue=Zc(t,"to",i),this.setEase(Zc(t,"ease",this.ease)),this.setDuration(Zc(t,"duration",this.duration)),this.setRepeat(Zc(t,"repeat",0)),this.setDelay(Zc(t,"delay",0)),this.setRepeatDelay(Zc(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Qc(this.fromValue,this.toValue,i)}}var eu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new tu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},iu={};Object.assign(iu,gc,vc,qc,eu);const su=23730,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.Utils.Objects.IsPlainObject;class au extends pc{constructor(t,e,i,s,r,n,a){nu(e)?(e=ru(a=e,"x",0),i=ru(a,"y",0),s=ru(a,"width",2),r=ru(a,"height",2),n=ru(a,"color",su)):nu(n)&&(n=ru(a=n,"color",su)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=su),this.setBoxShape(ru(a,"circleBox",!1)),this.setBoxFillStyle(n,ru(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ru(a,"uncheckedColor",null),ru(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ru(a,"boxLineWidth",4),ru(a,"boxStrokeColor",n),ru(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ru(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ru(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ru(a,"checkerColor",16777215),ru(a,"checkerAlpha",1)),this.setBoxSize(ru(a,"boxSize",1)),this.setCheckerSize(ru(a,"checkerSize",1)),this.setCheckerAnimationDuration(ru(a,"animationDuration",150)),this.buildShapes();var o=ru(a,"checked");void 0===o&&(o=ru(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(au.prototype,iu);const ou=Phaser.Utils.Objects.GetValue;class hu extends Ra{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(ou(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(ou(t,"enable",!0)),this.setMode(ou(t,"mode",1)),this.setClickInterval(ou(t,"clickInterval",100)),this.setDragThreshold(ou(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=lu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const lu={press:0,pointerdown:0,release:1,pointerup:1},du=Phaser.Utils.Objects.GetValue,cu=Phaser.Utils.Objects.IsPlainObject;class uu extends au{constructor(t,e,i,s,r,n,a){cu(e)?(e=du(a=e,"x",0),i=du(a,"y",0),s=du(a,"width",2),r=du(a,"height",2),n=du(a,"color",su)):cu(n)&&(n=du(a=n,"color",su)),super(t,e,i,s,r,n,a),this._click=new hu(this,du(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(du(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new uu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",uu);var pu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},gu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},vu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},fu=function(t,e,i){return(e-t)*i+t};const mu=Phaser.Math.Linear;var yu={buildShapes(){this.addShape((new Kc).setName("track")).addShape((new Kc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&fu(mn(l),mn(d),c))<<16|(255&fu(yn(l),yn(d),c))<<8|255&fu(bn(l),bn(d),c)),p=mu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=mu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},bu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new tu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},xu={};Object.assign(xu,pu,gu,vu,yu,bu);const Cu=Phaser.Utils.Objects.GetValue,ku=Phaser.Utils.Objects.IsPlainObject,wu=23730;class Su extends pc{constructor(t,e,i,s,r,n,a){ku(e)?(e=Cu(a=e,"x",0),i=Cu(a,"y",0),s=Cu(a,"width",2),r=Cu(a,"height",2),n=Cu(a,"color",wu)):ku(n)&&(n=Cu(a=n,"color",wu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wu),this.setTrackFillStyle(n,Cu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Cu(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Cu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Cu(a,"thumbColor",16777215),Cu(a,"thumbAlpha",1)),this.setTrackSize(Cu(a,"trackWidth",.9),Cu(a,"trackHeight",.5)),this.setTrackRadius(Cu(a,"trackRadius",.5*this.trackHeight));var o=Cu(a,"thumbHeight",void 0),h=Cu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Cu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Cu(a,"thumbLeft",.3),Cu(a,"thumbRight",void 0)),this.setRTL(Cu(a,"rtl",!1)),this.setToggleAnimationDuration(Cu(a,"animationDuration",150)),this.buildShapes(),this.setValue(Cu(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Su.prototype,xu);const Pu=Phaser.Utils.Objects.GetValue;class Tu extends Su{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hu(this,Pu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Pu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Tu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Tu);var Ou={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Mu extends Nt{}Object.assign(Mu.prototype,Ou),t.register("canvas",(function(t,e,i,s){var r=new Mu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Mu);const Eu=Phaser.Utils.Objects.GetValue;class _u extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Eu(i,"maskType",0),r=Eu(i,"backgroundColor",void 0),n=Eu(i,"strokeColor",void 0),a=Eu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ru[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Eu(i,"radius",0),f=Eu(i,"iteration",void 0);Zt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Ru={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new _u(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",_u);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Lu(i,"mask.key"),r=Lu(i,"mask.frame"),n=Lu(i,"mask.invertAlpha",!1),a=Lu(i,"mask.scale"),o=Lu(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Bu);const Iu=Phaser.Math.Linear,Du=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Du(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Du(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Iu(t,e,i)),i}};const Au=Phaser.Math.Percent;var zu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Au(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new tu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new tu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Fu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Math.Clamp;function Xu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Fu(t,"eventEmitter",this);var e=Fu(t,"valuechangeCallback",null);if(null!==e){var i=Fu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Fu(t,"easeValue.duration",0)).setEaseValueFunction(Fu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Yu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,ju,zu),e}const Wu=Phaser.Math.RadToDeg,Vu=Phaser.Math.DegToRad;var Gu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Vu(n),d=Vu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Hu={buildShapes(){var t=this.iterations;this.addShape((new Uc).setIterations(t).setName("track")).addShape((new Uc).setIterations(t).setName("bar")).addShape((new kc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Gu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Wu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Gu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Uu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,$u=Phaser.Math.Clamp,Ku=Phaser.Math.DegToRad(270);let Ju=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a){Nu(e)&&(e=Uu(a=e,"x",0),i=Uu(a,"y",0),s=Uu(a,"radius",1),r=Uu(a,"barColor",void 0),n=Uu(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Uu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Uu(a,"centerColor",void 0)),this.setThickness(Uu(a,"thickness",.2)),this.setStartAngle(Uu(a,"startAngle",Ku)),this.setAnticlockwise(Uu(a,"anticlockwise",!1)),this.iterations=Uu(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=$u(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Ju.prototype,Hu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Ju(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Ju);var qu=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const Zu=Phaser.Math.PI2;var Qu=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),qu(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+Zu)%Zu:(o+l*this.value)%Zu,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;qu(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),qu(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const tp=Phaser.Utils.Objects.GetValue,ep=Phaser.Utils.Objects.IsPlainObject,ip=Phaser.Math.Clamp,sp=Phaser.Math.DegToRad(270),rp=Phaser.Math.PI2;class np extends(Xu(Nt)){constructor(t,e,i,s,r,n,a){ep(e)&&(e=tp(a=e,"x",0),i=tp(a,"y",0),s=tp(a,"radius",1),r=tp(a,"barColor",void 0),n=tp(a,"value",0));var o=2*s;super(t,e,i,o,o,tp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(tp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(tp(a,"barColor2",void 0)),this.setCenterColor(tp(a,"centerColor",void 0)),this.setThickness(tp(a,"thickness",.2)),this.setStartAngle(tp(a,"startAngle",sp)),this.setEndAngle(tp(a,"endAngle",this.startAngle+rp)),this.setAnticlockwise(tp(a,"anticlockwise",!1)),this.setTextColor(tp(a,"textColor",void 0)),this.setTextStrokeColor(tp(a,"textStrokeColor",void 0),tp(a,"textStrokeThickness",void 0));var h=tp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(tp(a,"textSize","16px"),tp(a,"textFamily","Courier"),tp(a,"textStyle","")),this.setTextFormatCallback(tp(a,"textFormatCallback",void 0),tp(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=ip(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),Qu.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var ap=function(t,e,i){return i?t<=e?rp+t-e:t-e:t>=e?rp+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new np(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",np);var op=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const hp=Phaser.Utils.Objects.GetValue,lp=Phaser.Utils.Objects.IsPlainObject;let dp=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o){lp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):lp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):lp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(hp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(hp(o,"trackStrokeThickness",2),hp(o,"trackStrokeColor",void 0)),this.setSkewX(hp(o,"skewX",0)),this.setRTL(hp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var cp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&op(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),op(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&op(o,0,0,e,i,t)}};Object.assign(dp.prototype,cp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new dp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",dp);var up=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(Et(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,Et(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,Et(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,Et(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},pp=Phaser.Math.RadToDeg,gp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:pp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)&&n>e-a.x){var l=90-pp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,Et(a)&&n>e-a.x?(l=90-pp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,Et(a)?(l=n>a.x?90:pp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},vp=Phaser.Math.RadToDeg,fp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:vp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)?(l=n>a.y?90:vp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,Et(a)&&n>i-a.y){var l=90-vp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,Et(a)&&n>i-a.y?(l=90-vp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},mp=Phaser.Math.RadToDeg,yp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:mp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,Et(a)?(l=n>a.x?90:mp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,Et(a)&&n>e-a.x){var l=90-mp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,Et(a)&&n>e-a.x?(l=90-mp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},bp=Phaser.Math.RadToDeg,xp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:bp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,Et(a)?(l=n>a.y?90:bp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,Et(a)&&n>i-a.y){var l=90-bp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,Et(a)&&n>i-a.y?(l=90-bp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},Cp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const wp=Phaser.Utils.Objects.GetValue,Sp=Phaser.Utils.Objects.IsPlainObject;class Pp extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o,h){Sp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Sp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Sp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.bootProgressBase(h),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(wp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(wp(h,"trackStrokeThickness",2),wp(h,"trackStrokeColor",void 0)),this.setOrientation(wp(h,"orientation",0)),this.setRTL(wp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(wp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=kp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Tp={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&up(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?up(t,e,i,s,o):((0===n?a?yp:gp:a?xp:fp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&up(l,t,e,i,a)}};Object.assign(Pp.prototype,Tp),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Pp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Pp);var Op=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Op(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ep=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const _p=Phaser.Utils.Objects.GetValue,Rp=Phaser.Utils.Objects.IsPlainObject;class Lp extends(Xu(Nt)){constructor(t,e,i,s,r,n,a,o){Rp(e)?(e=_p(o=e,"x",0),i=_p(o,"y",0),s=_p(o,"width",2),r=_p(o,"height",2),n=_p(o,"barColor",void 0),a=_p(o,"value",0)):Rp(s)?(s=_p(o=s,"width",2),r=_p(o,"height",2),n=_p(o,"barColor",void 0),a=_p(o,"value",0)):Rp(n)&&(n=_p(o=n,"barColor",void 0),a=_p(o,"value",0)),super(t,e,i,s,r,_p(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(_p(o,"trackColor",void 0)),this.setBarColor(n,_p(o,"barColor2",void 0),_p(o,"isHorizontalGradient",void 0)),this.setTrackStroke(_p(o,"trackStrokeThickness",2),_p(o,"trackStrokeColor",void 0)),this.setSkewX(_p(o,"skewX",0)),this.setRTL(_p(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Mp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Lp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Lp),Phaser.Math.Wrap;const Bp=Phaser.Math.Linear;var Ip=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Bp(b.a.x,x.a.x,C),e=Bp(b.a.y,x.a.y,C),i=Bp(b.b.x,x.b.x,C),s=Bp(b.b.y,x.b.y,C),r=Bp(b.c.x,x.c.x,C),n=Bp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Dp=(0,Phaser.Math.DegToRad)(120);var jp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Dp),i+s*Math.sin(r+Dp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Dp),i+s*Math.sin(r-Dp)),this.arrowOnly?t.end():t.close()},Ap={buildShapes(){this.addShape((new Uc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Ip.call(this):jp.call(this)}},zp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new tu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Fp=Phaser.Utils.Objects.GetValue,Yp=Phaser.Utils.Objects.IsPlainObject,Xp=Phaser.Math.DegToRad,Wp=Phaser.Math.RadToDeg;class Vp extends pc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Yp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Hp(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Fp(r,"x",null);null!==n?(t=n,i=n):(t=Fp(r,"left",0),i=Fp(r,"right",t));var a=Fp(r,"y",null);null!==a?(e=a,s=a):(e=Fp(r,"top",0),s=Fp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Wp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Xp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Gp={right:0,down:1,left:2,up:3};var Hp=function(t){return"string"==typeof t&&(t=Gp[t]),t%=4};Object.assign(Vp.prototype,Ap,zp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Vp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Vp),F();const Up=Phaser.GameObjects.Zone,Np=Phaser.Utils.Array.Add,$p=Phaser.Utils.Array.Remove;let Kp=class extends Up{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(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),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Np(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return $p(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ieg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eeg(t).x,getChildLocalY:t=>eg(t).y};const mg=Phaser.Math.DegToRad;var yg={updateChildRotation(t){var e=eg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=eg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return eg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return eg(t).rotation=mg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=eg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>eg(t).rotation},bg={updateChildScale(t){var e=eg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=eg(t),i=e.parent;return e.scaleX=vg(t.scaleX,i.scaleX),e.scaleY=vg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=eg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=eg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>eg(t).scaleX,getChildLocalScaleY:t=>eg(t).scaleY},xg={updateChildVisible(t){var e=eg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=eg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),eg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),eg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=eg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>eg(t).visible},Cg={updateChildAlpha(t){var e=eg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=eg(t),i=e.parent;return e.alpha=vg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return eg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=eg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>eg(t).alpha},kg={updateChildActive(t){var e=eg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return eg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),eg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=eg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>eg(t).active},wg={updateChildScrollFactor(t){var e=eg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Sg={updateCameraFilter(t){var e=eg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Pg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Tg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Og={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Mg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _g=Phaser.Utils.Array;var Rg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Wv=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};const Vv=/(\S+)\[(\d+)\]/i;var Gv={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},Hv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Uv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Nv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},$v=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Kv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Jv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},qv={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Zv=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var cm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ea(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},um={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},pm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},gm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},vm={};Object.assign(vm,cm,um,pm,gm);const fm=Phaser.Utils.Objects.GetValue;class mm extends Ra{constructor(t,e){super(t,e),this.setTransitInTime(fm(e,"duration.in",200)),this.setTransitOutTime(fm(e,"duration.out",200)),this.setTransitInCallback(fm(e,"transitIn")),this.setTransitOutCallback(fm(e,"transitOut")),this.oneShotMode=fm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new dm(this,{eventEmitter:!1,initState:fm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(mm.prototype,vm);const ym=Phaser.GameObjects.Rectangle;class bm extends ym{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Md(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const xm=Phaser.Utils.Objects.GetValue;class Cm extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(xm(t,"hitAreaMode",0)),this.setEnable(xm(t,"enable",!0)),this.setStopMode(xm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=km[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var km={default:0,fullWindow:1};const wm=Phaser.Utils.Objects.GetValue;class Sm extends bm{constructor(t,e){super(t,wm(e,"color",0),wm(e,"alpha",.8)),this.touchEventStop=new Cm(this,{hitAreaMode:1})}}var Pm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,gf(t,e)},scaleDown(t,e){vf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Pf(t,e)},fadeOut(t,e){Tf(t,e,!1)}},Tm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Pf(t,e,t.alpha)},Om=function(t,e){Tf(t,e,!1)},Mm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Wn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Em=Phaser.Utils.Objects.GetValue;let _m=class extends mm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Rm.popUp),null==e.transitOut&&(e.transitOut=Rm.scaleDown),e.destroy=Em(e,"destroy",!0),super(t,e);var i=Em(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Sm(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Em(i,"transitIn",Tm)),this.setCoverTransitOutCallback(Em(i,"transitOut",Om)));var s=Em(e,"touchOutsideClose",!1),r=Em(e,"duration.hold",-1),n=Em(e,"timeOutClose",r>=0),a=Em(e,"anyTouchClose",!1);Em(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Em(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Mm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Rm[t]),t){case Rm.popUp:t=Pm.popUp;break;case Rm.fadeIn:t=Pm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Rm[t]),t){case Rm.scaleDown:t=Pm.scaleDown;break;case Rm.fadeOut:t=Pm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Rm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Lm=function(t,e){var i=new _m(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},Bm=function(t,e){t.emit("modal.requestClose",e)},Im=function(t){return t&&"function"==typeof t},Dm={modal(t,e){return Im(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Lm(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return Bm(this,t),this}},jm=function(t,e,i,s,r){Im(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Am={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return jm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return jm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return jm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return jm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return jm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return jm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return jm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return jm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return jm.call(this,"shutdown",t,e,i,s),this}},zm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Fm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Fm={},Ym=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Mm(t,e.x,e.y,i,s):!!(r=zm(e,n,!0))&&Mm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Qm={press:0,pointerdown:0,release:1,pointerup:1};var ty={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zm(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ey extends lm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const iy=Phaser.Utils.Objects.GetValue;class sy extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ey,this.parent.setInteractive(iy(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(iy(t,"enable",!0)),this.setCooldown(iy(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var ry={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ym(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ny={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},ay=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=ky,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===wy&&this.onDragEnd(),this.pointer=void 0,this.tracerState=ky,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Sy,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Ym(t,s,e,i)}}const ky=0,wy=1,Sy="IDLE",Py=Phaser.Utils.Objects.GetValue,Ty=Phaser.Math.Distance.Between;class Oy extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=My},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Py(t,"time",250)),this.setTapInterval(Py(t,"tapInterval",200)),this.setDragThreshold(Py(t,"threshold",9)),this.setTapOffset(Py(t,"tapOffset",10));var e=Py(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Py(t,"maxTaps",void 0)),this.setMinTaps(Py(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case My:this.state=Ey;break;case Ey:var t=this.lastPointer;Ty(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=_y,this.state=Ey);break;case _y:this.state=Ey}}onDragEnd(){this.state===Ey&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=_y))}onDrag(){this.state!==My&&this.pointer.getDistance()>this.dragThreshold&&(this.state=My)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Ey){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=My):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=_y:this.state=My)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===_y&&(this.state=My)}get isTapped(){return this.state===_y}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const My="IDLE",Ey="BEGIN",_y="RECOGNIZED",Ry=Phaser.Utils.Objects.GetValue;class Ly extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=By},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ry(t,"threshold",9)),this.setHoldTime(Ry(t,"time",251)),this}onDragStart(){this.state=Iy,0===this.holdTime&&(this.state=Dy)}onDragEnd(){this.state=By}onDrag(){this.state!==By&&this.pointer.getDistance()>this.dragThreshold&&(this.state=By)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Iy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Dy)}get isPressed(){return this.state===Dy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const By="IDLE",Iy="BEGIN",Dy="RECOGNIZED",jy=Phaser.Utils.Objects.GetValue;class Ay extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=zm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=zy},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(jy(t,"threshold",10)),this}onDragStart(){this.state=Fy,0===this.dragThreshold&&(this.state=Yy)}onDragEnd(){this.state=zy}onDrag(){switch(this.state){case Fy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Yy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Yy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=zm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Yy}setDragThreshold(t){return this.dragThreshold=t,this}}const zy="IDLE",Fy="BEGIN",Yy="RECOGNIZED",Xy=Phaser.Math.Distance.Between,Wy=Phaser.Math.Angle.Between;var Vy={getDt:function(){return rc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Xy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Wy(e.x,e.y,t.x,t.y)}},Gy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Hy={};const Uy=Phaser.Utils.Objects.GetValue,Ny=Phaser.Math.RadToDeg;class $y extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Ky},eventEmitter:!1};this.setRecongizedStateObject(new lm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Uy(t,"threshold",10)),this.setVelocityThreshold(Uy(t,"velocityThreshold",1e3)),this.setDirectionMode(Uy(t,"dir","8dir")),this}onDragStart(){this.state=Jy}onDragEnd(){this.state=Ky}onDrag(){this.state===Jy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=qy))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===qy&&(this.state=Ky)}get isSwiped(){return this.state===qy}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Gy[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Hy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Ny(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign($y.prototype,Vy);const Ky="IDLE",Jy="BEGIN",qy="RECOGNIZED",Zy=Phaser.Utils.Objects.GetValue,Qy=Phaser.Utils.Array.SpliceOne,tb=Phaser.Math.Distance.Between,eb=Phaser.Math.Angle.Between;class ib{constructor(t,e){var i=Ea(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Zy(e,"inputConfig",void 0)),this.setEventEmitter(Zy(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Zy(t,"enable",!0)),this.bounds=Zy(t,"bounds",void 0),this.tracerState=rb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case rb:this.tracerState=nb,this.onDrag1Start();break;case nb:this.tracerState=ab,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Qy(this.pointers,e),this.tracerState){case nb:this.tracerState=rb,this.onDrag1End();break;case ab:this.tracerState=nb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case nb:this.onDrag1();break;case ab:this.onDrag2()}}}dragCancel(){return this.tracerState===ab&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=rb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==ab)return 0;var t=this.pointers[0],e=this.pointers[1];return tb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==ab)return 0;var t=this.pointers[0],e=this.pointers[1];return eb(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;sb.x=e.x-i.x,sb.y=e.y-i.y}else sb.x=0,sb.y=0;return sb}get centerX(){if(this.tracerState!==ab)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==ab)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==ab)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==ab)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ob,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Ym(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Ym(t,s,e,i)}}Object.assign(ib.prototype,ln);var sb={};const rb=0,nb=1,ab=2,ob="IDLE",hb=Phaser.Utils.Objects.GetValue;class lb extends ib{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=db},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=cb,0===this.dragThreshold&&(this.state=ub)}onDrag2End(){this.state=db}onDrag2(){switch(this.state){case cb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=ub}break;case ub:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===ub}setDragThreshold(t){return this.dragThreshold=t,this}}const db="IDLE",cb="BEGIN",ub="RECOGNIZED",pb=Phaser.Math.RotateAround;var gb=function(t,e,i,s){return pb(t,e,i,s),t.rotation+=s,t},vb={};const fb=Phaser.Utils.Objects.GetValue,mb=Phaser.Math.Angle.WrapDegrees,yb=Phaser.Math.Angle.ShortestBetween,bb=Phaser.Math.RadToDeg,xb=Phaser.Math.DegToRad;class Cb extends ib{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=wb},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=mb(bb(this.angleBetween)),this.state=Sb,0===this.dragThreshold&&(this.state=Pb)}onDrag2End(){this.state=wb}onDrag2(){switch(this.state){case Sb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=mb(bb(this.angleBetween));this.angle=yb(this.prevAngle,t),this.prevAngle=t,this.state=Pb}break;case Pb:t=mb(bb(this.angleBetween)),this.angle=yb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Pb}get rotation(){return xb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var kb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=vb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=Ev(s),Vb(r)?(d.expandWidth=Gb(r,"width",!1),d.expandHeight=Gb(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?An(t):n),d.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}};const $b=Jg.prototype.clear;var Kb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),$b.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Xb.width=e.aspectRatio,Xb.height=1,Wb.width=o,Wb.height=h,o=(l=Ab(Xb,Wb,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Yb(t,this)):ef(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Nm.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(qb,Nb,Jb);var Zb=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const Qb=Phaser.Utils.Objects.IsPlainObject,tx=Phaser.Utils.Objects.GetValue;class ex extends jb{constructor(t,e,i,s,r,n){Qb(e)?(e=tx(n=e,"x",0),i=tx(n,"y",0),s=tx(n,"width",void 0),r=tx(n,"height",void 0)):Qb(s)&&(s=tx(n=s,"width",void 0),r=tx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return Zb(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ex.prototype,qb);var ix=Phaser.Math.Distance.Between,sx=function(t,e,i){var s=t.width/2;return ix(s,s,e,i)<=s};const rx=Phaser.Math.Angle.Between,nx=Phaser.Math.Angle.Normalize;var ax=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(sx(s,e,i)){var r=s.width/2,n=s.startAngle,a=rx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=nx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},ox=function(){this.sizerChildren.knob.on("pointerdown",ax,this).on("pointermove",ax,this).setInteractive()};const hx=Phaser.Math.Angle.Between,lx=Phaser.Math.Angle.Wrap;var dx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;sx(s,e,i)&&px.call(this,t)}},cx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case fx:sx(s,e,i)&&px.call(this,t);break;case mx:sx(s,e,i)?vx.call(this):gx.call(this)}}},ux=function(t,e,i){this.enable&&this.panPointer===t&&gx.call(this)},px=function(t){this.panPointer=t,this.panState=mx},gx=function(){this.panPointer=void 0,this.panState=fx},vx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=hx(i.x,i.y,t.x,t.y),r=hx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=lx(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const fx=0,mx=1;var yx=function(){this.sizerChildren.knob.on("pointerdown",dx,this).on("pointermove",cx,this).on("pointerup",ux,this).setInteractive(),this.panPointer=void 0,this.panState=fx},bx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},xx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:bx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(bx.call(this,t)),e.layout&&e.layout()),this}};const Cx=Phaser.Utils.Objects.GetValue,kx=Phaser.Math.Snap.To;class wx extends(Xu(ex)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Cx(e,"background",void 0),s=Cx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Cx(e,"textFormatCallback",void 0),Cx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new np(t,e);r.setDepth(Cx(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Cx(e,"enable",void 0)),this.setGap(Cx(e,"gap",void 0)),this.setValue(Cx(e,"value",0),Cx(e,"min",void 0),Cx(e,"max",void 0));var n=Cx(e,"input",0);switch("string"==typeof n&&(n=Sx[n]),n){case 0:yx.call(this);break;case 1:ox.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=kx(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Sx={pan:0,drag:0,click:1,none:-1};Object.assign(wx.prototype,xx),t.register("knob",(function(t){var e=new wx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",wx);const Px={arc:Cc,circle:kc,curve:class extends bc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),ak(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(fk.prototype,lk);const yk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new fk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",fk);const bk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,xk=Phaser.Utils.Objects.GetValue,Ck=Phaser.Math.Clamp;class kk extends bk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(xk(t,"progress",0)),this.setTransitionTargetTexture(xk(t,"toTexture","__DEFAULT"),xk(t,"toFrame",void 0),xk(t,"resizeMode",1)),this.setNoise(xk(t,"noiseX",void 0),xk(t,"noiseY",void 0),xk(t,"noiseZ",void 0)),this.setFromEdge(xk(t,"fromEdgeStart",.01),xk(t,"fromEdgeWidth",.05)),this.setToEdge(xk(t,"toEdgeStart",.01),xk(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Ck(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=wk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var wk={stretch:0,contain:1,cover:2};const Sk=Phaser.Utils.Array.SpliceOne,Pk=.1,Tk=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-wo(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-wo(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Yx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Sk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,kk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Ok extends fk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Tk.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(cw.prototype,aw),t.register("fileDropZone",(function(t){var e=new cw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",cw);const uw=Phaser.Math.Wrap;var pw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const mw=Phaser.Utils.Objects.IsPlainObject,yw=Phaser.Utils.Objects.GetValue,bw=Phaser.Display.Align.CENTER,xw={min:0,full:-1};var Cw=function(t,e,i,s,r,n,a,o,h,l){Rv.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=xw[e];else if(mw(e)){var u;e=yw(u=e,"proportion",void 0),i=yw(u,"align",bw),s=yw(u,"padding",0),r=yw(u,"expand",!1),n=yw(u,"key",void 0),a=yw(u,"index",void 0),t.isRexSizer||(o=yw(u,"minWidth",void 0),h=yw(u,"minHeight",void 0)),l=yw(u,"fitRatio",0)}return"string"==typeof i&&(i=Qg[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=bw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=An(t)/zn(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=Ev(s),u.expand=r,u.fitRatio=0===e?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?An(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},kw={add:Cw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Cw.call(this,new vw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return mw(i)&&(i.index=t),Cw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=fw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ww=Phaser.Utils.Array.Remove;var Sw={remove(t,e){return this.getParentSizer(t)!==this||(ww(this.sizerChildren,t),zv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kb.call(this,t),this}},Pw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Qg[e]),this.getSizerConfig(t).align=e,this}},Tw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ow={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Mw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ew={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(ef(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Zv.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,g=this.innerHeight,v=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=$v.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Uv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&pw.call(this,t,void 0),Nv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Kv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&pw.call(this,void 0,t),Jv.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Ew,kw,Sw,Pw,Tw,Ow,Mw);var _w=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Rw=Phaser.Utils.Objects.IsPlainObject,Lw=Phaser.Utils.Objects.GetValue;class Bw extends jb{constructor(t,e,i,s,r,n,a){Rw(e)?(e=Lw(a=e,"x",0),i=Lw(a,"y",0),s=Lw(a,"width",void 0),r=Lw(a,"height",void 0),n=Lw(a,"orientation",0)):Rw(s)?(s=Lw(a=s,"width",void 0),r=Lw(a,"height",void 0),n=Lw(a,"orientation",0)):Rw(n)&&(n=Lw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Lw(a,"space.item",0)),this.setStartChildIndex(Lw(a,"startChildIndex",0)),this.setRTL(Lw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_w.call(this)),this._childrenProportion}}Object.assign(Bw.prototype,Ew);var Iw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Dw={appendText:Mi,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class jw extends Bw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Iw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Iw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Iw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Iw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(jw.prototype,Dw);var Aw=function(t,e,i,s){var r=new tk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const zw=Phaser.GameObjects.Text;var Fw=function(t){return t instanceof zw};const Yw=Phaser.GameObjects.BitmapText;var Xw=function(t){return t instanceof Yw},Ww=function(t){return Xw(t)?2:Fw(t)?0:1},Vw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Hw=function(t,e){switch(Ww(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Vw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Uw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Xw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Fw(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Nw=65535;var $w=function(t,e,i){if(null==e)return t;if(0===e)return qw(t,0,i),t;var s=t.text.length;if(0===s)return qw(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=Jw(t,r,e,i,n),o=0;o<=Nw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Jw(t,r,e,i,n)}return o===Nw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qw(t,e,i),t},Kw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jw=function(t,e,i,s,r){var n,a=Kw(t,e,r),o=Kw(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},qw=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zw=Phaser.Utils.Objects.GetValue;var Qw=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zw(e,"minWidth",0),s=Zw(e,"minHeight",0),r=Zw(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return $w(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),$w(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const tS=Phaser.Utils.Objects.GetValue;class eS extends jw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=tS(e,"background",void 0),r=tS(e,"icon",void 0),n=tS(e,"iconMask",void 0),a=tS(e,"text",void 0),o=tS(e,"action",void 0),h=tS(e,"actionMask",void 0),l=tS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:tS(e,"space.icon",0),top:tS(e,"space.iconTop",0),bottom:tS(e,"space.iconBottom",0),left:tS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:tS(e,"space.icon",0),left:tS(e,"space.iconLeft",0),right:tS(e,"space.iconRight",0),top:tS(e,"space.iconTop",0)});var d=tS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Aw.call(this,r,r,1)),!d){var c=tS(e,"iconSize",void 0);this.setIconSize(tS(e,"iconWidth",c),tS(e,"iconHeight",c))}}if(a){var u=tS(e,"wrapText",!1),p=tS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hw(a,u),e.expandTextWidth=!0,Uw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Qw(a,{fitHeight:!0}));var g,v,f=tS(e,"space.text",0),m=tS(e,"expandTextWidth",!1),y=tS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:tS(e,"space.actionTop",0),bottom:tS(e,"space.actionBottom",0),right:tS(e,"space.actionRight",0)}:{left:tS(e,"space.actionLeft",0),right:tS(e,"space.actionRight",0),bottom:tS(e,"space.actionBottom",0)},d=tS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Aw.call(this,o,o,1)),!d)){var b=tS(e,"actionSize");this.setActionSize(tS(e,"actionWidth",b),tS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const iS=Phaser.Utils.Objects.GetValue;var sS=function(t,e){var i=iS(e,"canvas"),s=iS(i,"width",128),r=iS(i,"height",128),n=new Mu(t,0,0,s,r);t.add.existing(n);var a=iS(i,"key"),o=iS(i,"frame"),h=iS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const rS=Phaser.Utils.Objects.GetValue;var nS=function(t,e){var i=rS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const aS=Phaser.Utils.Objects.GetValue,oS={accept:"image/*",multiple:!1};var hS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},lS={async openPromise(){var t=this;return Kk(this.scene.game,oS).then((function(e){return hS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},dS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(dS,lS);const cS=Phaser.Utils.Objects.GetValue;class uS extends eS{constructor(t,e){var i=function(t,e){var i=new Lk(t,{scaleUp:iS(e,"scaleUpIcon",!1),background:iS(e,"iconBackground"),image:sS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=nS(this,e),this.clickTarget&&(cS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new iw(e,oS);return e.add.existing(i),t.pin(i),i.on("change",(function(){hS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=nS(t,e);if(i){var s=aS(e,"click"),r=new hu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(uS.prototype,dS),t.register("imageInputLabel",(function(t){var e=new uS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",uS);let pS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const gS=Phaser.Utils.Objects.GetValue;class vS extends Ra{constructor(t,e){super(t,e),this.style=gS(e,"style",this);var i=gS(e,"propertiesMap");this.activeStyle=fS(e,"active",i),this.hoverStyle=fS(e,"hover",i),this.disableStyle=fS(e,"disable",i),this.onModifyStyle=gS(e,"onModifyStyle")}getStyle(t){return Bd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Id(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return mS.call(this,"active",t),this}setHoverState(t){return mS.call(this,"hover",t),this}setDisableState(t){return mS.call(this,"disable",t),this}}var fS=function(t,e,i){var s=Rd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},mS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},yS={addStyleManager(t){return this.styleManager=new vS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const bS=Phaser.GameObjects.Image,xS=Phaser.Utils.Objects.GetValue;class CS extends bS{constructor(t,e){void 0===e&&(e={}),super(t,xS(e,"x",0),xS(e,"y",0),xS(e,"key",""),xS(e,"frame",void 0)),this.type="rexStatesImage";var i=xS(e,"effects",!0);i&&Mn(this,i),this.style=new pS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(CS.prototype,yS),t.register("statesImage",(function(t){var e=new CS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",CS);class kS extends jt{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=wS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const wS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(kS.prototype,yS),t.register("statesRoundRectangle",(function(t){var e=new kS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",kS);let SS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const PS=Phaser.GameObjects.NineSlice,TS=Phaser.Utils.Objects.GetValue;class OS extends PS{constructor(t,e){void 0===e&&(e={}),super(t,TS(e,"x",0),TS(e,"y",0),TS(e,"key",null),TS(e,"frame",null),TS(e,"width",0),TS(e,"height",0),TS(e,"leftWidth",0),TS(e,"rightWidth",0),TS(e,"topHeight",0),TS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=TS(e,"effects",!0);i&&Mn(this,i),this.style=new SS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(OS.prototype,yS),t.register("statesNineSlice",(function(t){var e=new OS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",OS);let MS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const ES=Phaser.Utils.Objects.GetValue;class _S extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ES(e,"effects",!0);i&&Mn(this,i),this.style=new MS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,yS),t.register("statesNinePatch",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",_S);const RS=Phaser.GameObjects.Text,LS=Phaser.Utils.Objects.GetValue;class BS extends RS{constructor(t,e){void 0===e&&(e={}),super(t,LS(e,"x",0),LS(e,"y",0),LS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(BS.prototype,yS),t.register("statesText",(function(t){var e=new BS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",BS);class IS extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const DS=Phaser.GameObjects.BitmapText,jS=Phaser.Utils.Objects.GetValue;class AS extends DS{constructor(t,e){void 0===e&&(e={});var i=jS(e,"x",0),s=jS(e,"y",0),r=jS(e,"font",""),n=jS(e,"fontSize",!1),a=jS(e,"align",0),o=jS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=jS(e,"effects",!0);h&&Mn(this,h),this.style=new IS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(AS.prototype,yS),t.register("statesBitmapText",(function(t){var e=new AS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",AS);class zS extends dp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=FS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const FS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zS.prototype,yS),t.register("statesBarRectangle",(function(t){var e=new zS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",zS);var YS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let XS=class extends Mu{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var WS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,YS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return JS(this.sizerChildren,null),Kb.call(this,t),this}},ZS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JS(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},iP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=$v.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,JS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},rP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const nP=Phaser.Utils.Objects.IsPlainObject,aP=Phaser.Utils.Objects.GetValue;class oP extends jb{constructor(t,e,i,s,r,n,a,o,h,l){nP(e)?(e=aP(l=e,"x",0),i=aP(l,"y",0),s=aP(l,"width",void 0),r=aP(l,"height",void 0),n=aP(l,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(s)?(s=aP(l=s,"width",void 0),r=aP(l,"height",void 0),n=aP(l,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(n)?(n=aP(l=n,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(o)&&(o=aP(l=o,"columnProportions",0),h=aP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(aP(l,"createCellContainerCallback")),this.setIndentLeft(aP(l,"space.indentLeftOdd",0),aP(l,"space.indentLeftEven",0)),this.setIndentTop(aP(l,"space.indentTopOdd",0),aP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,aP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=sP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=rP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(oP.prototype,iP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new oP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",oP);var hP=function(t,e,i,s){return e/t<=i?e/(s-1):0},lP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=dP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=dP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const uP=Phaser.Utils.Objects.IsPlainObject,pP=Phaser.Utils.Objects.GetValue,gP=Phaser.Display.Align.CENTER;var vP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Rv.call(this,t),uP(e)&&(e=pP(r=e,"padding",0),i=pP(r,"key",void 0),s=pP(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=gP,r.padding=Ev(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},fP={add(t,e,i){if(Xm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kb.call(this,t),this}},bP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const lT=Phaser.Utils.Objects.GetValue,dT=Phaser.Math.Distance.Between;class cT extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=lT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(lT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(lT(t,"enable",!0)),this.holdThreshold=lT(t,"holdThreshold",50),this.pointerOutReleaseEnable=lT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return rc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:dT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Ym(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Ym(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const uT=Phaser.Utils.Objects.GetValue;class pT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(uT(t,"value",0)),this.setSpeed(uT(t,"speed",0)),this.setAcceleration(uT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class gT{constructor(){this.value,this.dir,this.movement=new pT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const yT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},bT=Phaser.Utils.Objects.GetValue;class xT extends Ra{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=bT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(bT(e,"speed",.1)),this.setEnable(bT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(bT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Ym(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const CT=Phaser.Utils.Objects.GetValue;var kT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?CT(s,l,void 0):CT(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ve(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new oT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=CT(r,"position",0);"string"==typeof p&&(p=wT[p]);var g,v,f=CT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=CT(s,"space.slider",void 0))&&(o?f=0:g=CT(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:CT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:CT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:CT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:CT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=CT(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=CT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=CT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=CT(s,"scrollDetectionMode");"string"==typeof b&&(b=ST[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?CT(s,x,!0):CT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new mT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=CT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new xT(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const wT={right:0,left:1,bottom:0,top:1},ST={gameObject:0,rectBounds:1},PT=Phaser.Utils.Objects.GetValue;var TT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=PT(e,"width"),a=PT(e,"height");n||PT(e,"child.expandWidth",!0)||(s[1]=0),a||PT(e,"child.expandHeight",!0)||(r[1]=0);var o=new oP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=LP(i,"child"),r=LP(s,"gameObject",void 0);if(r){var n=LP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=LP(n,"top",0),a.bottom=LP(n,"bottom",0),o.left=LP(n,"left",0),o.right=LP(n,"right",0);break;case 1:a.top=LP(n,"left",0),a.bottom=LP(n,"right",0),o.top=LP(n,"top",0),o.bottom=LP(n,"bottom",0);break;default:a.top=LP(n,"top",0),a.bottom=LP(n,"bottom",0),a.left=LP(n,"left",0),a.right=LP(n,"right",0)}e.add(r,{column:1,row:1,align:LP(s,"align","center"),padding:o,expand:{width:LP(s,"expandWidth",!0),height:LP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:kT(t,o,"y",e);break;case 1:kT(t,o,"x",e);break;default:kT(t,o,"y",e),kT(t,o,"x",e)}return o},OT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},MT=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},ET=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},jT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},AT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},zT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},FT=function(t,e){switch(Ww(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},YT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&XT.call(this)},XT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},WT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},VT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=DT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(jT.call(this,-this.textOY)),0),e=AT.call(this,t)+this.textOY,i=zT.call(this,t);return FT(this.textObject,i),this.textObject.rexSizer.offsetY=e,YT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Zv.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,WT.call(this,t,n,a),wv(t,s,r,n,a,e.align),e.preOffsetY=0,YT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const GT=Phaser.Utils.Objects.IsPlainObject,HT=Phaser.Utils.Objects.GetValue,UT=Phaser.Display.Align.TOP_LEFT;class NT extends jb{constructor(t,e,i,s,r,n){GT(e)?(e=HT(n=e,"x",0),i=HT(n,"y",0),s=HT(n,"width",void 0),r=HT(n,"height",void 0)):GT(s)&&(s=HT(n=s,"width",void 0),r=HT(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=HT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(HT(n,"clampTextOY",!0)),this.alwaysScrollable=HT(n,"alwaysScrollable",!1);var a=HT(n,"background",void 0),o=HT(n,"text",void 0);void 0===o&&(o=$T(t)),this.textCropEnable=HT(n,"textCrop",!!o.setCrop);var h=HT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=UT,l.padding=Ev(0),l.expand=!0,this.textObject=o,this.textObjectType=Ww(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Aw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(jT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=AT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var $T=function(t){return t.add.text(0,0,"")};Object.assign(NT.prototype,VT);var KT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},JT={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const qT=Phaser.Utils.Objects.GetValue;class ZT extends BT{constructor(t,e){void 0===e&&(e={});var i=qT(e,"text",void 0),s=qT(e,"textWidth",void 0),r=qT(e,"textHeight",void 0),n=qT(e,"textCrop",!!i.setCrop),a=qT(e,"textMask",!n),o=qT(e,"content",""),h=new NT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:qT(e,"clampChildOY",!1),alwaysScrollable:qT(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=qT(e,"space",void 0);l&&(l.child=qT(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(ZT.prototype,KT,JT);const QT=Phaser.Utils.Objects.GetValue;var tO=function(t,e,s){e=e?i(e):{};var r=QT(s,"background",MP),n=QT(s,"text",eO),a=QT(s,"track",MP),o=QT(s,"thumb",MP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new ZT(t,e);return t.add.existing(l),l},eO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new AS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new nO(t,e);break;case"textarea":s=tO(t,e);break;default:s=new BS(t,e)}return OP(s,e),t.add.existing(s),s},iO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _S(t,e):new OS(t,e);break;case"roundRectangle":s=new kS(t,e);break;default:s=new CS(t,e)}return OP(s,e),t.add.existing(s),s};const sO=Phaser.Utils.Objects.GetValue;var rO=function(t,e,s){e=e?i(e):{};var r=sO(s,"background",MP),n=sO(s,"text",eO),a=sO(s,"icon",iO),o=sO(s,"action",iO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class nO extends eS{constructor(t,e,i){super(t,e=rO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return aO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return aO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return aO(this.getChildren(),"setDisableState",t),this}}var aO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=SO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Xm(s)||(s=Bc(EO,i,1)),SO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=RO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=_O[t]),this.timeUnit=t,this}}var EO=[];const _O={ms:0,s:1,sec:1},RO={abs:0,absolute:0,inc:1,increment:1};var LO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},BO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const IO=Phaser.Utils.Objects.GetValue;class DO extends kO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(IO(e,"easeDuration",1e3)),this.levelCounter=new wO(IO(e,"levelCounter")),this.player=new MO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",LO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(DO.prototype,BO),t.register("expBar",(function(t){var e=new DO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",DO);const jO=Bw.prototype.add,AO=Bw.prototype.addSpace;var zO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&AO.call(this),jO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&AO.call(this),this.hasTailSpace=s}else jO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;jO.call(this,t,{index:r,proportion:i,expand:!0})}else jO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},FO={addButton(t){if(Xm(t))for(var e=t,i=0,s=e.length;i=0;i--)WO.call(this,e[i],t);return this}},GO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},HO=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,GO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},UO={add(t){return this.buttons.push(t),t._click||(t._click=new hu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),HO.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)hM.call(this,e[i],t);return this}};const dM=Phaser.Utils.Objects.GetValue;class cM extends oP{constructor(t,e){void 0===e&&(e={});var i=dM(e,"row",0),s=dM(e,"column",e.col||0),r=dM(e,"createCellContainerCallback"),n=dM(e,"buttons",void 0),a=dM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&uM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)mM.call(this,e[i],t);return this}};const bM=Phaser.Utils.Objects.GetValue;class xM extends SP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new QO({parent:this,eventEmitter:bM(e,"eventEmitter",this),groupName:bM(e,"groupName",void 0),clickConfig:bM(e,"click",void 0)}).setButtonsType(e);var s=bM(e,"background",void 0),r=bM(e,"buttons",void 0);this.buttonsAlign=bM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(xM.prototype,gM,yM,ZO,eM),t.register("fixWidthButtons",(function(t){var e=new xM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",xM);var CM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const kM=Phaser.Utils.Objects.GetValue;class wM extends eS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new iw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(kM(e,"accept","")),this.setMultiple(kM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(wM.prototype,CM),t.register("fileSelectorButton",(function(t){var e=new wM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",wM);var SM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},PM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Dm.modal.call(this,t,e),this}},TM={};Object.assign(TM,SM,PM);const OM=Phaser.Utils.Objects.GetValue;class MM extends Bw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=OM(e,"eventEmitter",this);var i,s,r,n,a=OM(e,"background",void 0),o=OM(e,"title",void 0),h=OM(e,"toolbar",void 0),l=OM(e,"toolbarBackground",void 0),d=OM(e,"leftToolbar",void 0),c=OM(e,"leftToolbarBackground",void 0),u=OM(e,"content",void 0),p=OM(e,"description",void 0),g=OM(e,"choices",void 0),v=OM(e,"choicesBackground",void 0),f=OM(e,"actions",void 0),m=OM(e,"actionsBackground",void 0),y=OM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new sM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:OM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new sM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:OM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&OM(e,"expand.title",!0),C=OM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Bw(t,{orientation:0}):new ex(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:OM(e,"space.titleLeft",0),right:OM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:OM(e,"space.title",0),top:OM(e,"space.titleTop",0)}),P=OM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=OM(e,"align.content","center"),O=OM(e,"space.content",0),M=(S={left:OM(e,"space.contentLeft",0),right:OM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=OM(e,"proportion.content",0),OM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=OM(e,"align.description","center");var E=OM(e,"space.description",0);S={left:OM(e,"space.descriptionLeft",0),right:OM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=OM(e,"proportion.description",0),M=OM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=OM(e,"choicesType","").split("-"),R=EM(_,"wrap")?xM:EM(_,"grid")?cM:sM,L=EM(_,"radio")?"radio":EM(_,"checkboxes")?"checkboxes":void 0,B={left:OM(e,"space.choicesBackgroundLeft",0),right:OM(e,"space.choicesBackgroundRight",0),top:OM(e,"space.choicesBackgroundTop",0),bottom:OM(e,"space.choicesBackgroundBottom",0)},I=OM(e,"space.choice",0);R===sM?B.item=I:R===xM?(B.item=I,B.line=OM(e,"space.choiceLine",I)):(B.column=OM(e,"space.choiceColumn",I),B.row=OM(e,"space.choiceRow",I));var D={width:OM(e,"choicesWidth",void 0),height:OM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:OM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:OM(e,"choicesSetValueCallbackScope",void 0)};R===sM&&(D.orientation=EM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=OM(e,"space.choices",0);S={left:OM(e,"space.choicesLeft",0),right:OM(e,"space.choicesRight",0),bottom:f?j:0},T=OM(e,"align.choices","center"),P=OM(e,"proportion.choices",0),M=OM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new sM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:OM(e,"space.action",0)},expand:OM(e,"expand.actions",!1),align:OM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:OM(e,"space.actionsLeft",0),right:OM(e,"space.actionsRight",0),bottom:OM(e,"space.actionsBottom",0)},P=OM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),RM(this,"click"),RM(this,"over"),RM(this,"out"),RM(this,"enable"),RM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var EM=function(t,e){return-1!==t.indexOf(e)},_M={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},RM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){_M.hasOwnProperty(s)&&t.emit(`${_M[s]}.${e}`,i,r,n,a)}))};Object.assign(MM.prototype,TM),t.register("dialog",(function(t){var e=new MM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",MM);var LM=function(t,e,i){var s=new nO(t,e,i);return t.add.existing(s),s},BM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},IM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},DM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=VE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(j_.prototype,L_);const A_=["top","bottom","centerY","center"],z_=["left","right","centerX","center"];var F_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=A_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=z_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Y_=Phaser.Utils.Objects.GetValue;class X_ extends BT{constructor(t,e){void 0===e&&(e={});var i=_P(e),s=Y_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Y_(e,"clampChildOY",!1),s.clampChildOX=Y_(e,"clampChildOX",!1);var r,n,a=new j_(t,s);switch(t.add.existing(a),i){case 0:r=Y_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Y_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Y_(e,"align.panel","center")};var o=Y_(e,"space",void 0);o&&(o.child=Y_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Bb(this.childrenMap.child,t),this}}var W_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:F_.call(this,t,"y",e);break;case 1:F_.call(this,t,"x",e);break;default:F_.call(this,t,"y",e),F_.call(this,t,"x",e)}return this}};Object.assign(X_.prototype,W_);const V_=Phaser.Utils.Objects.GetValue;var G_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=H_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=U_(e,this.listCreateSliderTrackCallback),g=U_(e,this.listCreateSliderThumbCallback);d=new X_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:V_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=H_(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},H_=function(t,e,i){var s;return i?(e.orientation="x",s=new xM(t,e)):(e.orientation="y",s=new sM(t,e)),t.add.existing(s),s},U_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const N_=Phaser.Utils.Objects.GetValue;var $_=function(t,e){var i=N_(e,"expandDirection",void 0);"string"==typeof i&&(i=K_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Td(s=e,r="alignTarget")?J(s,r):n&&Td(s,n)?J(s,n):a&&Td(s,a)?J(s,a):o),c=N_(e,"alignTargetY",d),u=N_(e,"alignOffsetX",0),p=N_(e,"alignOffsetY",0),g=N_(e,"alignSide","").includes("right"),v=N_(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=aa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const K_={down:0,up:1},J_=Phaser.Utils.Objects.GetValue;class q_ extends mm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){gf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new uf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),$_(t,e),t.isRexSizer&&t.layout();var i=J_(e,"touchOutsideClose",!1),s=J_(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Mm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Z_={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Q_={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=G_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new q_(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Q_,__,Z_);const tR=Phaser.Utils.Objects.GetValue;class eR extends eS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(tR(e,"options"));var i=tR(e,"list");this.setWrapEnable(tR(i,"wrap",!1)),this.setCreateButtonCallback(tR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(tR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(tR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(tR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(tR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(tR(i,"scroller")),this.setListMouseWheelScrollerConfig(tR(i,"mouseWheelScroller")),this.setButtonClickCallback(tR(i,"onButtonClick")),this.setButtonOverCallback(tR(i,"onButtonOver")),this.setButtonOutCallback(tR(i,"onButtonOut")),this.setListExpandDirection(tR(i,"expandDirection")),this.setListEaseInDuration(tR(i,"easeIn",500)),this.setListEaseOutDuration(tR(i,"easeOut",100)),this.setListTransitInCallback(tR(i,"transitIn")),this.settListTransitOutCallback(tR(i,"transitOut")),this.setListMaxHeight(tR(i,"maxHeight",0)),this.setListSize(tR(i,"width"),tR(i,"height",0)),this.setListAlignmentMode(tR(i,"alignParent","text")),this.setListAlignmentSide(tR(i,"alignSide","")),this.setListBounds(tR(i,"bounds")),this.setListSpace(tR(i,"space")),this.setListDraggable(tR(i,"draggable",!1)),this.setValueChangeCallback(tR(e,"setValueCallback"),tR(e,"setValueCallbackScope")),this.setValue(tR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(eR.prototype,Q_),t.register("dropDownList",(function(t){var e=new eR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",eR);var iR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=rO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=LM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return MP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return MP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class sR extends eR{constructor(t,e,i){super(t,e=iR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(hR,rR,aR,oR);const lR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class dR extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ww(this.parent),this.pageStartIndexes=[],this.lines=DT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(lR(t,"maxLines",void 0)),this.setPageBreak(lR(t,"pageBreak","\f\n")),this.setText(lR(t,"text","")),this.startLineIndex=lR(t,"start",-1),this.endLineIndex=lR(t,"end",void 0);var e=lR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Ww(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(dR.prototype,hR);var cR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?FT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Ae(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},uR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},pR=function(t,e){for(var i=void 0,s=0;s0?gR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=gR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},fR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=uR(this.parent,t);n=pR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)vR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(fR,cR);const mR=Phaser.Utils.Objects.GetFastValue,yR=Phaser.Utils.Objects.GetValue;class bR extends Ra{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(yR(t,"wrap",!1)),this.setTypeMode(yR(t,"typeMode",0)),this.setTypingSpeed(yR(t,"speed",333)),this.setTextCallback=mR(t,"setTextCallback",null),this.setTextCallbackScope=mR(t,"setTextCallbackScope",null),this.setTypingContent(mR(t,"text","")),this.typingIndex=mR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=mR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=xR[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Ae(t);this.textWrapEnable&&(e=function(t,e){switch(Ww(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=uR(this.parent,this.text).length,this}onTyping(){var t=vR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?FT(this.parent,t):this.parent.setText(t)}}const xR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(bR.prototype,fR);const CR=Phaser.Utils.Objects.GetValue,kR={page:0,line:1};class wR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=CR(i,"expandTextWidth",!1),n=CR(i,"expandTextHeight",!1);if(r||n){var a=Ww(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(CR(i,"typingMode","page")),this.page=new dR(s,CR(i,"page",void 0)),this.typing=new bR(s,CR(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=kR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(cO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new wR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",wR);class SR extends wR{constructor(t,e,i){super(t,e=pO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new SR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",SR);const PR=Phaser.Utils.Objects.GetValue;class TR extends Bw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=PR(e,"background",void 0),a=PR(e,"icon",void 0),o=PR(e,"iconMask",void 0),h=PR(e,"slider",void 0),l=PR(e,"text",void 0),d=PR(e,"space.icon",0),c=PR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Aw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new sT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===PR(h,"width",void 0)?1:0:void 0===PR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=PR(e,"valuechangeCallback",null);if(null!==u){var p=PR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(PR(e,"enable",void 0)),this.setValue(PR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new TR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",TR),t.register("scrollBar",(function(t){var e=new oT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",oT);const OR=Phaser.Utils.Objects.GetValue,MR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class ER extends ex{constructor(t,e){super(t,e),this.type="rexBadge";var i=OR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=OR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),MR){var n=OR(e,r,void 0);n&&(this.add(n,{key:r,align:MR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new ER(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",ER);const _R=ex.prototype.add;var RR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),_R.call(this,t,e,i,s,r,n,a,o,h),this},LR={add:RR,addPage:RR};const BR=Jg.prototype.setChildVisible;var IR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(BR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(BR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(IR,LR);const DR=Phaser.Utils.Objects.GetValue;class jR extends ex{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(DR(e,"swapMode",0)),this.setFadeInDuration(DR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=AR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(jR.prototype,IR);const AR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new jR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",jR);const zR=Phaser.GameObjects.Mesh;class FR extends zR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const YR=Phaser.Math.Vector3,XR=Phaser.Math.Matrix4;var WR=new YR,VR=new YR,GR=new XR;const HR=Phaser.Utils.Objects.IsPlainObject,UR=Phaser.Utils.Objects.GetValue,NR=Phaser.Geom.Mesh.GenerateGridVerts,$R=Phaser.Math.RadToDeg,KR=Phaser.Math.DegToRad,JR=1+1/Math.sin(KR(45));let qR=class extends FR{constructor(t,e,i,s,r,n){HR(e)&&(e=UR(n=e,"x",0),i=UR(n,"y",0),s=UR(n,"key",null),r=UR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(JR),this.hideCCW=UR(n,"hideCCW",!0);var a=UR(n,"gridWidth",0),o=UR(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,NR({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return $R(this.rotationX)}set angleX(t){this.rotationX=KR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return $R(this.rotationY)}set angleY(t){this.rotationY=KR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return $R(this.rotationZ)}set angleZ(t){this.rotationZ=KR(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),WR.set(e,i,s),VR.set(r,n,a),GR.fromRotationXYTranslation(VR,WR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},AL={top:1,left:3,right:5,bottom:7},zL={top:"bottom",left:"right",right:"left",bottom:"top"},FL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},YL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}XB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},GB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(FB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;YB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return VB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),YB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new FI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},XI={openColorPicker:function(){if(!this.colorPicker){var t=YI.call(this).layout(),e=new q_(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(XI,hI);const WI=Phaser.Utils.Objects.GetValue;class VI extends oI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(WI(i,"width",160),WI(i,"height",170));var n=WI(i,"background");r=n?function(t){return MP(t,n)}:WI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(WI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(WI(i,"expandDirection")),this.setColorPickerEaseInDuration(WI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(WI(i,"easeOut",200)),this.setColorPickerTransitInCallback(WI(i,"transitIn")),this.setColorPickerTransitOutCallback(WI(i,"transitOut")),this.setColorPickerBounds(WI(i,"bounds"));var a=WI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(WI(o,"height",30)),this.setColorComponentsFormatLabelConfig(WI(o,"formatLabel"));var h=WI(o,"inputText");h||(h=WI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=WI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(VI.prototype,XI),t.register("colorInput",(function(t){var e=new VI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",VI),t.register("colorInputLite",(function(t){var e=new oI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",oI),t.register("colorPicker",(function(t){var e=new _I(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",_I),t.register("colorComponents",(function(t){var e=new AI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",AI);var GI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&xh;d--){for(c=0;c0&&this.wrapMode!==Ee&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Be[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Pe(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Jt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Jt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Be[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var Ae=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Fe=Phaser.Utils.Objects.GetValue,Ye=Te,Xe=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xe&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ye&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xe&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ve=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ne({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var gs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Yi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Os.prototype,Z);var Ms={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,js=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const As=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=js(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ys);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new As,Fs=new As),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Xs(t,e,n,a,r)},Vs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Hs(this._rotation)}set angle(t){this.rotation=Gs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Qs=Phaser.Utils.Objects.GetValue;class tr{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Jt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Pi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let mr=class extends Ns{constructor(t,e){super(t,ar),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const kr={none:0,word:1,char:2,character:2,mix:3};var wr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),er(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(sr);return null===i?i=new ur(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ws(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cn),function(t){if(t.events)return t;var e=new xn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mn(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},An=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Yn=Phaser.Math.Vector2,Xn=Phaser.Math.RotateAround;var Wn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Vn&&(Vn=new Fn),e=Vn),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Gn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Hn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Gn(t,e),i=e.x,s=e.y,Hn(t,e),r=e.x,n=e.y,Un(t,e),a=e.x,o=e.y,Nn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Vn=void 0,Gn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopRight?t.getTopRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},$n=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn);var s=An(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Jn(t,e,i)},Kn=void 0,Jn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Xn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=qn(i,"color"),r=qn(i,"lineWidth"),n=qn(i,"fillColor"),a=qn(i,"fillAlpha",1),o=qn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Va:Wa,this.repeatCounter=0,this}stop(){return this.state=Xa,this}update(t,e){this.state!==Xa&&this.state!==Ha&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ga)):(this.nowTime=this.duration,this.state=Ha):this.nowTime>=0&&(this.state=Va))}get t(){var t;switch(this.state){case Xa:case Wa:case Ga:t=0;break;case Va:t=this.nowTime/this.duration;break;case Ha:t=1}return Fa(t,0,1)}set t(t){(t=Fa(t,-1,1))<0?(this.state=Wa,this.nowTime=-this.delay*t):(this.state=Va,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Xa}get isDelay(){return this.state===Wa}get isCountDown(){return this.state===Va}get isRunning(){return this.state===Wa||this.state===Va}get isDone(){return this.state===Ha}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Xa=0,Wa=1,Va=2,Ga=3,Ha=-1;class Ua extends ja{constructor(t,e){super(t,e),this.timer=new Ya}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Na=Phaser.Utils.Objects.GetValue,$a=Phaser.Utils.Objects.GetAdvancedValue,Ka=Phaser.Tweens.Builders.GetEaseFunction;class Ja extends Ua{resetFromJSON(t){return this.timer.resetFromJSON(Na(t,"timer")),this.setEnable(Na(t,"enable",!0)),this.setTarget(Na(t,"target",this.parent)),this.setDelay($a(t,"delay",0)),this.setDuration($a(t,"duration",1e3)),this.setEase(Na(t,"ease","Linear")),this.setRepeat(Na(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ka(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const qa=Phaser.Sound.BaseSound;var Za=function(t){return t instanceof qa};const Qa=Phaser.Utils.Objects.GetValue,to=Phaser.Utils.Objects.GetAdvancedValue,eo=Phaser.Math.Linear;let io=class extends Ja{constructor(t,e,i){Za(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Qa(t,"mode",0)),this.setEnable(Qa(t,"enable",!0)),this.setVolumeRange(to(t,"volume.start",this.parent.volume),to(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=so[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=eo(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const so={stop:1,destroy:2};var ro=function(t,e,i,s,r){Za(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new io(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},no=function(t,e,i,s){Za(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new io(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ao=Phaser.Utils.Objects.GetValue;var oo={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ao(e,"loop",this.backgroundMusicLoop),mute:ao(e,"mute",this.backgroundMusicMute),volume:ao(e,"volume",this.backgroundMusicVolume),detune:ao(e,"detune",0),rate:ao(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ro(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&no(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ho=Phaser.Utils.Objects.GetValue;var lo={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusic2Mute),volume:ho(e,"volume",this.backgroundMusic2Volume),detune:ho(e,"detune",0),rate:ho(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ro(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&no(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const co=Phaser.Utils.Array.Remove,uo=Phaser.Utils.Objects.GetValue;var po={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:uo(e,"mute",this.soundEffectsMute),volume:uo(e,"volume",this.soundEffectsVolume),detune:uo(e,"detune",0),rate:uo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&co(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&co(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ro(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&no(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)no(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ro(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&no(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)no(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=qo:t||(t=Qo),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=eh),this.tagExpression=t,this}setValueExpression(t){return t||(t=eh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==eh||this.valueExpression!==eh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=qo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:al,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===sr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,ol.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},hl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},ll=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},dl=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const cl=Phaser.Input.Keyboard.KeyCodes;var ul=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},Ol=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const _l=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Pl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Tl,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Pl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],xr.call(t,`${s}.pause`,Ml,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);xr.call(t,`${s}.chain`,El,[s,r,a],t),e.skipEvent()}}}))}];var Rl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=_l,t.createGameObject=Cl(t.createGameObject),this.addGameObjectManager(t,Sl)},Ll=function(t,e){return 2===t.length&&t[0]===e},Bl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Dl=function(t){this.getGameObjectManager(t).removeAll()},jl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Al={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},zl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Fl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ll(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Bl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ll(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Il,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Dl,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],xr.call(t,`${s}.call`,jl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Al[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,zl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Yl=Wo.addGameObjectManager;var Xl={addGameObjectManager(t,e){(t=t?Ve(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Yl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Fl]:Fl).length;a0)return nd.length=0,!0;return nd.length=0,!1},nd=[],ad=void 0;const od=Phaser.Utils.Objects.GetValue;var hd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=od(e,n,s[1]))&&(i[s[0]]=r);return i},ld=function(t){t.addEventListener("touchstart",dd,!1),t.addEventListener("touchmove",dd,!1),t.addEventListener("touchend",dd,!1),t.addEventListener("mousedown",dd,!1),t.addEventListener("mouseup",dd,!1),t.addEventListener("mousemove",dd,!1)},dd=function(t){t.stopPropagation()},cd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},ud=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",cd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(xa.call(this.clickOutSideTarget,this.parent),ba.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},pd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",cd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const gd=Phaser.Utils.Objects.GetValue;var vd=function(t,e){var i,s=gd(e,"inputType",void 0);void 0===s&&(s=gd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=gd(e,"style",void 0),n=i.style;hd(ed,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",hd(td,e,i),ld(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){ud.call(t)})),i.addEventListener("blur",(function(e){pd.call(t)})),i},fd={open:function(){return this.isOpened||this.readOnly||((t=this)!==ad&&(void 0!==ad&&ad.close(),ad=t),this.node||(this.node=vd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===ad&&(ad=void 0),this.setBlur(),this):this}};const md=Phaser.Utils.Objects.GetValue;class yd extends Ra{constructor(t,e){super(t);var i=md(e,"inputType",void 0);void 0===i&&(i=md(e,"type","text")),this.setEnterCloseEnable(md(e,"enterClose","textarea"!==i));var s=md(e,"onOpen",void 0);s||(s=md(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=md(e,"clickOutSideTarget",void 0);var r=md(e,"onClose",void 0);r||(r=md(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=md(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return id(t,e,"inputType"),id(t,e,"type"),id(t,e,"style"),id(t,e,ed),id(t,e,td),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){sd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(yd.prototype,fd);var bd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},xd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(xd(this),Cd(this)),this}setNumberInput(){return this.onUpdateCallback=bd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Sd=Phaser.Utils.Objects.GetValue,Pd=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Td=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ed=Phaser.GameObjects.Zone;let _d=class extends Ed{constructor(t){super(t,0,0,2,2),this.fullWindow=new Md(this)}};var Rd=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Ld=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Bd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Ad.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(zd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Fd=new Ad,Yd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Xd=/\S/,Wd=new Ad;Wd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Xd.test(t)&&!Xd.test(e)},Wd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Ud(t,null,null,i),i," ")},Hd.equals=function(t,e){return Ad.prototype.equals.call(Hd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nd=new Ad;Nd.tokenize=function(t){return t.slice()},Nd.join=Nd.removeEmpty=function(t){return t};const $d=Phaser.Utils.Array.Remove;var Kd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$d(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Fd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},tc={cursorMoveLeft(){if(!this.isOpened)return this;var t=qd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=qd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ec=Phaser.Utils.Objects.IsPlainObject;class ic extends hn{constructor(t,e,i,s,r,n){ec(e)?n=e:ec(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Td(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Td(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Td(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Td(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Td(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new _d(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Rd(n.background,"focus"),h=Rd(n.style,"cursor");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Sd(e,"edit");return void 0===i&&(i={}),id(e,i,Pd),new wd(t,i)}(this,n),Ld.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Dd.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=$c(t,"tl",0),this.radiusTR=$c(t,"tr",0),this.radiusBL=$c(t,"bl",0),this.radiusBR=$c(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Lt(e,e,e,e,180,270,!1,r,t):Lt(0,0,e,e,90,0,!0,r,t):_t(0,0,t),(e=this.radiusTR)>0?this._convexTR?Lt(i-e,e,e,e,270,360,!1,r,t):Lt(i,0,e,e,180,90,!0,r,t):_t(i,0,t),(e=this.radiusBR)>0?this._convexBR?Lt(i-e,s-e,e,e,0,90,!1,r,t):Lt(i,s,e,e,270,180,!0,r,t):_t(i,s,t),(e=this.radiusBL)>0?this._convexBL?Lt(e,s-e,e,e,90,180,!1,r,t):Lt(0,s,e,e,360,270,!0,r,t):_t(0,s,t),t.push(t[0],t[1]),Ec(this.x,this.y,t),super.updateData(),this}}const Jc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var qc={buildShapes(){this.addShape((new Kc).setName("box")).addShape((new Uc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Math.Linear;class tu extends Ja{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Zc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Zc(t,"from",i),this.toValue=Zc(t,"to",i),this.setEase(Zc(t,"ease",this.ease)),this.setDuration(Zc(t,"duration",this.duration)),this.setRepeat(Zc(t,"repeat",0)),this.setDelay(Zc(t,"delay",0)),this.setRepeatDelay(Zc(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Qc(this.fromValue,this.toValue,i)}}var eu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new tu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},iu={};Object.assign(iu,gc,vc,qc,eu);const su=23730,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.Utils.Objects.IsPlainObject;class au extends pc{constructor(t,e,i,s,r,n,a){nu(e)?(e=ru(a=e,"x",0),i=ru(a,"y",0),s=ru(a,"width",2),r=ru(a,"height",2),n=ru(a,"color",su)):nu(n)&&(n=ru(a=n,"color",su)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=su),this.setBoxShape(ru(a,"circleBox",!1)),this.setBoxFillStyle(n,ru(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ru(a,"uncheckedColor",null),ru(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ru(a,"boxLineWidth",4),ru(a,"boxStrokeColor",n),ru(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ru(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ru(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ru(a,"checkerColor",16777215),ru(a,"checkerAlpha",1)),this.setBoxSize(ru(a,"boxSize",1)),this.setCheckerSize(ru(a,"checkerSize",1)),this.setCheckerAnimationDuration(ru(a,"animationDuration",150)),this.buildShapes();var o=ru(a,"checked");void 0===o&&(o=ru(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(au.prototype,iu);const ou=Phaser.Utils.Objects.GetValue;class hu extends Ra{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(ou(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(ou(t,"enable",!0)),this.setMode(ou(t,"mode",1)),this.setClickInterval(ou(t,"clickInterval",100)),this.setDragThreshold(ou(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=lu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const lu={press:0,pointerdown:0,release:1,pointerup:1},du=Phaser.Utils.Objects.GetValue,cu=Phaser.Utils.Objects.IsPlainObject;class uu extends au{constructor(t,e,i,s,r,n,a){cu(e)?(e=du(a=e,"x",0),i=du(a,"y",0),s=du(a,"width",2),r=du(a,"height",2),n=du(a,"color",su)):cu(n)&&(n=du(a=n,"color",su)),super(t,e,i,s,r,n,a),this._click=new hu(this,du(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(du(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new uu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",uu);var pu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},gu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},vu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},fu=function(t,e,i){return(e-t)*i+t};const mu=Phaser.Math.Linear;var yu={buildShapes(){this.addShape((new Kc).setName("track")).addShape((new Kc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&fu(mn(l),mn(d),c))<<16|(255&fu(yn(l),yn(d),c))<<8|255&fu(bn(l),bn(d),c)),p=mu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=mu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},bu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new tu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},xu={};Object.assign(xu,pu,gu,vu,yu,bu);const Cu=Phaser.Utils.Objects.GetValue,ku=Phaser.Utils.Objects.IsPlainObject,wu=23730;class Su extends pc{constructor(t,e,i,s,r,n,a){ku(e)?(e=Cu(a=e,"x",0),i=Cu(a,"y",0),s=Cu(a,"width",2),r=Cu(a,"height",2),n=Cu(a,"color",wu)):ku(n)&&(n=Cu(a=n,"color",wu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wu),this.setTrackFillStyle(n,Cu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Cu(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Cu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Cu(a,"thumbColor",16777215),Cu(a,"thumbAlpha",1)),this.setTrackSize(Cu(a,"trackWidth",.9),Cu(a,"trackHeight",.5)),this.setTrackRadius(Cu(a,"trackRadius",.5*this.trackHeight));var o=Cu(a,"thumbHeight",void 0),h=Cu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Cu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Cu(a,"thumbLeft",.3),Cu(a,"thumbRight",void 0)),this.setRTL(Cu(a,"rtl",!1)),this.setToggleAnimationDuration(Cu(a,"animationDuration",150)),this.buildShapes(),this.setValue(Cu(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Su.prototype,xu);const Pu=Phaser.Utils.Objects.GetValue;class Tu extends Su{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hu(this,Pu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Pu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Tu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Tu);var Ou={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Mu extends Nt{}Object.assign(Mu.prototype,Ou),t.register("canvas",(function(t,e,i,s){var r=new Mu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Mu);const Eu=Phaser.Utils.Objects.GetValue;class _u extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Eu(i,"maskType",0),r=Eu(i,"backgroundColor",void 0),n=Eu(i,"strokeColor",void 0),a=Eu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ru[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Eu(i,"radius",0),f=Eu(i,"iteration",void 0);Zt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Ru={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new _u(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",_u);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends Nt{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Lu(i,"mask.key"),r=Lu(i,"mask.frame"),n=Lu(i,"mask.invertAlpha",!1),a=Lu(i,"mask.scale"),o=Lu(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Bu);const Iu=Phaser.Math.Linear,Du=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Du(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Du(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Iu(t,e,i)),i}};const Au=Phaser.Math.Percent;var zu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Au(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new tu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new tu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Fu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Math.Clamp;function Xu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Fu(t,"eventEmitter",this);var e=Fu(t,"valuechangeCallback",null);if(null!==e){var i=Fu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Fu(t,"easeValue.duration",0)).setEaseValueFunction(Fu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Yu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,ju,zu),e}const Wu=Phaser.Math.RadToDeg,Vu=Phaser.Math.DegToRad;var Gu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Vu(n),d=Vu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Hu={buildShapes(){var t=this.iterations;this.addShape((new Uc).setIterations(t).setName("track")).addShape((new Uc).setIterations(t).setName("bar")).addShape((new kc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Gu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Wu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Gu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Uu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,$u=Phaser.Math.Clamp,Ku=Phaser.Math.DegToRad(270);let Ju=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a){Nu(e)&&(e=Uu(a=e,"x",0),i=Uu(a,"y",0),s=Uu(a,"radius",1),r=Uu(a,"barColor",void 0),n=Uu(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Uu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Uu(a,"centerColor",void 0)),this.setThickness(Uu(a,"thickness",.2)),this.setStartAngle(Uu(a,"startAngle",Ku)),this.setAnticlockwise(Uu(a,"anticlockwise",!1)),this.iterations=Uu(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=$u(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Ju.prototype,Hu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Ju(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Ju);var qu=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const Zu=Phaser.Math.PI2;var Qu=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),qu(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+Zu)%Zu:(o+l*this.value)%Zu,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;qu(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),qu(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const tp=Phaser.Utils.Objects.GetValue,ep=Phaser.Utils.Objects.IsPlainObject,ip=Phaser.Math.Clamp,sp=Phaser.Math.DegToRad(270),rp=Phaser.Math.PI2;class np extends(Xu(Nt)){constructor(t,e,i,s,r,n,a){ep(e)&&(e=tp(a=e,"x",0),i=tp(a,"y",0),s=tp(a,"radius",1),r=tp(a,"barColor",void 0),n=tp(a,"value",0));var o=2*s;super(t,e,i,o,o,tp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(tp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(tp(a,"barColor2",void 0)),this.setCenterColor(tp(a,"centerColor",void 0)),this.setThickness(tp(a,"thickness",.2)),this.setStartAngle(tp(a,"startAngle",sp)),this.setEndAngle(tp(a,"endAngle",this.startAngle+rp)),this.setAnticlockwise(tp(a,"anticlockwise",!1)),this.setTextColor(tp(a,"textColor",void 0)),this.setTextStrokeColor(tp(a,"textStrokeColor",void 0),tp(a,"textStrokeThickness",void 0));var h=tp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(tp(a,"textSize","16px"),tp(a,"textFamily","Courier"),tp(a,"textStyle","")),this.setTextFormatCallback(tp(a,"textFormatCallback",void 0),tp(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=ap(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=ip(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),Qu.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var ap=function(t,e,i){return i?t<=e?rp+t-e:t-e:t>=e?rp+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new np(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",np);var op=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const hp=Phaser.Utils.Objects.GetValue,lp=Phaser.Utils.Objects.IsPlainObject;let dp=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o){lp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):lp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):lp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(hp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(hp(o,"trackStrokeThickness",2),hp(o,"trackStrokeColor",void 0)),this.setSkewX(hp(o,"skewX",0)),this.setRTL(hp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var cp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&op(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),op(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&op(o,0,0,e,i,t)}};Object.assign(dp.prototype,cp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new dp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",dp);var up=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(Et(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,Et(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,Et(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,Et(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},pp=Phaser.Math.RadToDeg,gp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(Et(a)){l=n>a.x?90:pp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)&&n>e-a.x){var l=90-pp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,Et(a)&&n>e-a.x?(l=90-pp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,Et(a)?(l=n>a.x?90:pp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},vp=Phaser.Math.RadToDeg,fp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(Et(a)){l=n>a.y?90:vp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,Et(a)?(l=n>a.y?90:vp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,Et(a)&&n>i-a.y){var l=90-vp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,Et(a)&&n>i-a.y?(l=90-vp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},mp=Phaser.Math.RadToDeg,yp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(Et(a)){l=n>a.x?90:mp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,Et(a)?(l=n>a.x?90:mp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,Et(a)&&n>e-a.x){var l=90-mp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,Et(a)&&n>e-a.x?(l=90-mp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},bp=Phaser.Math.RadToDeg,xp=function(t,e,i,s,r){var n=i*r,a=s.br;if(Et(a)){l=n>a.y?90:bp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,Et(a)?(l=n>a.y?90:bp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,Et(a)&&n>i-a.y){var l=90-bp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,Et(a)&&n>i-a.y?(l=90-bp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},Cp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const wp=Phaser.Utils.Objects.GetValue,Sp=Phaser.Utils.Objects.IsPlainObject;class Pp extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o,h){Sp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Sp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Sp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.bootProgressBase(h),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(wp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(wp(h,"trackStrokeThickness",2),wp(h,"trackStrokeColor",void 0)),this.setOrientation(wp(h,"orientation",0)),this.setRTL(wp(h,"rtl",!1)),this.rrGeom=new Pt,this.setRadius(n),this.setIteration(wp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=kp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Tp={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&up(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?up(t,e,i,s,o):((0===n?a?yp:gp:a?xp:fp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&up(l,t,e,i,a)}};Object.assign(Pp.prototype,Tp),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Pp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Pp);var Op=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Op(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Ep=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const _p=Phaser.Utils.Objects.GetValue,Rp=Phaser.Utils.Objects.IsPlainObject;class Lp extends(Xu(Nt)){constructor(t,e,i,s,r,n,a,o){Rp(e)?(e=_p(o=e,"x",0),i=_p(o,"y",0),s=_p(o,"width",2),r=_p(o,"height",2),n=_p(o,"barColor",void 0),a=_p(o,"value",0)):Rp(s)?(s=_p(o=s,"width",2),r=_p(o,"height",2),n=_p(o,"barColor",void 0),a=_p(o,"value",0)):Rp(n)&&(n=_p(o=n,"barColor",void 0),a=_p(o,"value",0)),super(t,e,i,s,r,_p(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(_p(o,"trackColor",void 0)),this.setBarColor(n,_p(o,"barColor2",void 0),_p(o,"isHorizontalGradient",void 0)),this.setTrackStroke(_p(o,"trackStrokeThickness",2),_p(o,"trackStrokeColor",void 0)),this.setSkewX(_p(o,"skewX",0)),this.setRTL(_p(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Mp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Lp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Lp),Phaser.Math.Wrap;const Bp=Phaser.Math.Linear;var Ip=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Bp(b.a.x,x.a.x,C),e=Bp(b.a.y,x.a.y,C),i=Bp(b.b.x,x.b.x,C),s=Bp(b.b.y,x.b.y,C),r=Bp(b.c.x,x.c.x,C),n=Bp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Dp=(0,Phaser.Math.DegToRad)(120);var jp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Dp),i+s*Math.sin(r+Dp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Dp),i+s*Math.sin(r-Dp)),this.arrowOnly?t.end():t.close()},Ap={buildShapes(){this.addShape((new Uc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Ip.call(this):jp.call(this)}},zp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new tu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Fp=Phaser.Utils.Objects.GetValue,Yp=Phaser.Utils.Objects.IsPlainObject,Xp=Phaser.Math.DegToRad,Wp=Phaser.Math.RadToDeg;class Vp extends pc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Yp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Hp(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Fp(r,"x",null);null!==n?(t=n,i=n):(t=Fp(r,"left",0),i=Fp(r,"right",t));var a=Fp(r,"y",null);null!==a?(e=a,s=a):(e=Fp(r,"top",0),s=Fp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Wp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Xp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Gp={right:0,down:1,left:2,up:3};var Hp=function(t){return"string"==typeof t&&(t=Gp[t]),t%=4};Object.assign(Vp.prototype,Ap,zp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Vp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Vp),F();const Up=Phaser.GameObjects.Zone,Np=Phaser.Utils.Array.Add,$p=Phaser.Utils.Array.Remove;let Kp=class extends Up{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(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),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Np(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return $p(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ieg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eeg(t).x,getChildLocalY:t=>eg(t).y};const mg=Phaser.Math.DegToRad;var yg={updateChildRotation(t){var e=eg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=eg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return eg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return eg(t).rotation=mg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=eg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>eg(t).rotation},bg={updateChildScale(t){var e=eg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=eg(t),i=e.parent;return e.scaleX=vg(t.scaleX,i.scaleX),e.scaleY=vg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=eg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=eg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>eg(t).scaleX,getChildLocalScaleY:t=>eg(t).scaleY},xg={updateChildVisible(t){var e=eg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=eg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),eg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),eg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=eg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>eg(t).visible},Cg={updateChildAlpha(t){var e=eg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=eg(t),i=e.parent;return e.alpha=vg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return eg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=eg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>eg(t).alpha},kg={updateChildActive(t){var e=eg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return eg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),eg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=eg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>eg(t).active},wg={updateChildScrollFactor(t){var e=eg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Sg={updateCameraFilter(t){var e=eg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Pg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(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}},Tg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Og={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Mg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _g=Phaser.Utils.Array;var Rg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Wv=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};const Vv=/(\S+)\[(\d+)\]/i;var Gv={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},Hv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Uv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Nv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},$v=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Kv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Jv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},qv={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Zv=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var cm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ea(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},um={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},pm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},gm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},vm={};Object.assign(vm,cm,um,pm,gm);const fm=Phaser.Utils.Objects.GetValue;class mm extends Ra{constructor(t,e){super(t,e),this.setTransitInTime(fm(e,"duration.in",200)),this.setTransitOutTime(fm(e,"duration.out",200)),this.setTransitInCallback(fm(e,"transitIn")),this.setTransitOutCallback(fm(e,"transitOut")),this.oneShotMode=fm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new dm(this,{eventEmitter:!1,initState:fm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(mm.prototype,vm);const ym=Phaser.GameObjects.Rectangle;class bm extends ym{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Md(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const xm=Phaser.Utils.Objects.GetValue;class Cm extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(xm(t,"hitAreaMode",0)),this.setEnable(xm(t,"enable",!0)),this.setStopMode(xm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=km[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var km={default:0,fullWindow:1};const wm=Phaser.Utils.Objects.GetValue;class Sm extends bm{constructor(t,e){super(t,wm(e,"color",0),wm(e,"alpha",.8)),this.touchEventStop=new Cm(this,{hitAreaMode:1})}}var Pm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,gf(t,e)},scaleDown(t,e){vf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Pf(t,e)},fadeOut(t,e){Tf(t,e,!1)}},Tm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Pf(t,e,t.alpha)},Om=function(t,e){Tf(t,e,!1)},Mm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Wn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Em=Phaser.Utils.Objects.GetValue;let _m=class extends mm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Rm.popUp),null==e.transitOut&&(e.transitOut=Rm.scaleDown),e.destroy=Em(e,"destroy",!0),super(t,e);var i=Em(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Sm(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Em(i,"transitIn",Tm)),this.setCoverTransitOutCallback(Em(i,"transitOut",Om)));var s=Em(e,"touchOutsideClose",!1),r=Em(e,"duration.hold",-1),n=Em(e,"timeOutClose",r>=0),a=Em(e,"anyTouchClose",!1);Em(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Em(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Mm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Rm[t]),t){case Rm.popUp:t=Pm.popUp;break;case Rm.fadeIn:t=Pm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Rm[t]),t){case Rm.scaleDown:t=Pm.scaleDown;break;case Rm.fadeOut:t=Pm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Rm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Lm=function(t,e){var i=new _m(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},Bm=function(t,e){t.emit("modal.requestClose",e)},Im=function(t){return t&&"function"==typeof t},Dm={modal(t,e){return Im(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Lm(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return Bm(this,t),this}},jm=function(t,e,i,s,r){Im(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Am={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return jm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return jm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return jm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return jm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return jm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return jm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return jm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return jm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return jm.call(this,"shutdown",t,e,i,s),this}},zm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Fm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Fm={},Ym=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Mm(t,e.x,e.y,i,s):!!(r=zm(e,n,!0))&&Mm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Qm={press:0,pointerdown:0,release:1,pointerup:1};var ty={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zm(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ey extends lm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const iy=Phaser.Utils.Objects.GetValue;class sy extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ey,this.parent.setInteractive(iy(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(iy(t,"enable",!0)),this.setCooldown(iy(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var ry={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ym(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new sy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ny={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},ay=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=ky,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===wy&&this.onDragEnd(),this.pointer=void 0,this.tracerState=ky,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Sy,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Ym(t,s,e,i)}}const ky=0,wy=1,Sy="IDLE",Py=Phaser.Utils.Objects.GetValue,Ty=Phaser.Math.Distance.Between;class Oy extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=My},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Py(t,"time",250)),this.setTapInterval(Py(t,"tapInterval",200)),this.setDragThreshold(Py(t,"threshold",9)),this.setTapOffset(Py(t,"tapOffset",10));var e=Py(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Py(t,"maxTaps",void 0)),this.setMinTaps(Py(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case My:this.state=Ey;break;case Ey:var t=this.lastPointer;Ty(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=_y,this.state=Ey);break;case _y:this.state=Ey}}onDragEnd(){this.state===Ey&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=_y))}onDrag(){this.state!==My&&this.pointer.getDistance()>this.dragThreshold&&(this.state=My)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Ey){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=My):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=_y:this.state=My)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===_y&&(this.state=My)}get isTapped(){return this.state===_y}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const My="IDLE",Ey="BEGIN",_y="RECOGNIZED",Ry=Phaser.Utils.Objects.GetValue;class Ly extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=By},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ry(t,"threshold",9)),this.setHoldTime(Ry(t,"time",251)),this}onDragStart(){this.state=Iy,0===this.holdTime&&(this.state=Dy)}onDragEnd(){this.state=By}onDrag(){this.state!==By&&this.pointer.getDistance()>this.dragThreshold&&(this.state=By)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Iy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Dy)}get isPressed(){return this.state===Dy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const By="IDLE",Iy="BEGIN",Dy="RECOGNIZED",jy=Phaser.Utils.Objects.GetValue;class Ay extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=zm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=zy},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(jy(t,"threshold",10)),this}onDragStart(){this.state=Fy,0===this.dragThreshold&&(this.state=Yy)}onDragEnd(){this.state=zy}onDrag(){switch(this.state){case Fy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Yy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Yy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=zm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Yy}setDragThreshold(t){return this.dragThreshold=t,this}}const zy="IDLE",Fy="BEGIN",Yy="RECOGNIZED",Xy=Phaser.Math.Distance.Between,Wy=Phaser.Math.Angle.Between;var Vy={getDt:function(){return rc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Xy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Wy(e.x,e.y,t.x,t.y)}},Gy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Hy={};const Uy=Phaser.Utils.Objects.GetValue,Ny=Phaser.Math.RadToDeg;class $y extends Cy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Ky},eventEmitter:!1};this.setRecongizedStateObject(new lm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Uy(t,"threshold",10)),this.setVelocityThreshold(Uy(t,"velocityThreshold",1e3)),this.setDirectionMode(Uy(t,"dir","8dir")),this}onDragStart(){this.state=Jy}onDragEnd(){this.state=Ky}onDrag(){this.state===Jy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=qy))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===qy&&(this.state=Ky)}get isSwiped(){return this.state===qy}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Gy[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Hy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Ny(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign($y.prototype,Vy);const Ky="IDLE",Jy="BEGIN",qy="RECOGNIZED",Zy=Phaser.Utils.Objects.GetValue,Qy=Phaser.Utils.Array.SpliceOne,tb=Phaser.Math.Distance.Between,eb=Phaser.Math.Angle.Between;class ib{constructor(t,e){var i=Ea(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Zy(e,"inputConfig",void 0)),this.setEventEmitter(Zy(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Zy(t,"enable",!0)),this.bounds=Zy(t,"bounds",void 0),this.tracerState=rb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case rb:this.tracerState=nb,this.onDrag1Start();break;case nb:this.tracerState=ab,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Qy(this.pointers,e),this.tracerState){case nb:this.tracerState=rb,this.onDrag1End();break;case ab:this.tracerState=nb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case nb:this.onDrag1();break;case ab:this.onDrag2()}}}dragCancel(){return this.tracerState===ab&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=rb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==ab)return 0;var t=this.pointers[0],e=this.pointers[1];return tb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==ab)return 0;var t=this.pointers[0],e=this.pointers[1];return eb(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;sb.x=e.x-i.x,sb.y=e.y-i.y}else sb.x=0,sb.y=0;return sb}get centerX(){if(this.tracerState!==ab)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==ab)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==ab)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==ab)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ob,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Ym(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Ym(t,s,e,i)}}Object.assign(ib.prototype,ln);var sb={};const rb=0,nb=1,ab=2,ob="IDLE",hb=Phaser.Utils.Objects.GetValue;class lb extends ib{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=db},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=cb,0===this.dragThreshold&&(this.state=ub)}onDrag2End(){this.state=db}onDrag2(){switch(this.state){case cb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=ub}break;case ub:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===ub}setDragThreshold(t){return this.dragThreshold=t,this}}const db="IDLE",cb="BEGIN",ub="RECOGNIZED",pb=Phaser.Math.RotateAround;var gb=function(t,e,i,s){return pb(t,e,i,s),t.rotation+=s,t},vb={};const fb=Phaser.Utils.Objects.GetValue,mb=Phaser.Math.Angle.WrapDegrees,yb=Phaser.Math.Angle.ShortestBetween,bb=Phaser.Math.RadToDeg,xb=Phaser.Math.DegToRad;class Cb extends ib{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=wb},eventEmitter:!1};this.setRecongizedStateObject(new lm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=mb(bb(this.angleBetween)),this.state=Sb,0===this.dragThreshold&&(this.state=Pb)}onDrag2End(){this.state=wb}onDrag2(){switch(this.state){case Sb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=mb(bb(this.angleBetween));this.angle=yb(this.prevAngle,t),this.prevAngle=t,this.state=Pb}break;case Pb:t=mb(bb(this.angleBetween)),this.angle=yb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Pb}get rotation(){return xb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var kb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=vb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=Ev(s),Vb(r)?(d.expandWidth=Gb(r,"width",!1),d.expandHeight=Gb(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?An(t):n),d.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}};const $b=Jg.prototype.clear;var Kb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),$b.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Xb.width=e.aspectRatio,Xb.height=1,Wb.width=o,Wb.height=h,o=(l=Ab(Xb,Wb,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Yb(t,this)):ef(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Nm.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(qb,Nb,Jb);var Zb=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const Qb=Phaser.Utils.Objects.IsPlainObject,tx=Phaser.Utils.Objects.GetValue;class ex extends jb{constructor(t,e,i,s,r,n){Qb(e)?(e=tx(n=e,"x",0),i=tx(n,"y",0),s=tx(n,"width",void 0),r=tx(n,"height",void 0)):Qb(s)&&(s=tx(n=s,"width",void 0),r=tx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return Zb(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ex.prototype,qb);var ix=Phaser.Math.Distance.Between,sx=function(t,e,i){var s=t.width/2;return ix(s,s,e,i)<=s};const rx=Phaser.Math.Angle.Between,nx=Phaser.Math.Angle.Normalize;var ax=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(sx(s,e,i)){var r=s.width/2,n=s.startAngle,a=rx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=nx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},ox=function(){this.sizerChildren.knob.on("pointerdown",ax,this).on("pointermove",ax,this).setInteractive()};const hx=Phaser.Math.Angle.Between,lx=Phaser.Math.Angle.Wrap;var dx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;sx(s,e,i)&&px.call(this,t)}},cx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case fx:sx(s,e,i)&&px.call(this,t);break;case mx:sx(s,e,i)?vx.call(this):gx.call(this)}}},ux=function(t,e,i){this.enable&&this.panPointer===t&&gx.call(this)},px=function(t){this.panPointer=t,this.panState=mx},gx=function(){this.panPointer=void 0,this.panState=fx},vx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=hx(i.x,i.y,t.x,t.y),r=hx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=lx(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const fx=0,mx=1;var yx=function(){this.sizerChildren.knob.on("pointerdown",dx,this).on("pointermove",cx,this).on("pointerup",ux,this).setInteractive(),this.panPointer=void 0,this.panState=fx},bx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},xx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:bx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(bx.call(this,t)),e.layout&&e.layout()),this}};const Cx=Phaser.Utils.Objects.GetValue,kx=Phaser.Math.Snap.To;class wx extends(Xu(ex)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Cx(e,"background",void 0),s=Cx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Cx(e,"textFormatCallback",void 0),Cx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new np(t,e);r.setDepth(Cx(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Cx(e,"enable",void 0)),this.setGap(Cx(e,"gap",void 0)),this.setValue(Cx(e,"value",0),Cx(e,"min",void 0),Cx(e,"max",void 0));var n=Cx(e,"input",0);switch("string"==typeof n&&(n=Sx[n]),n){case 0:yx.call(this);break;case 1:ox.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=kx(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Sx={pan:0,drag:0,click:1,none:-1};Object.assign(wx.prototype,xx),t.register("knob",(function(t){var e=new wx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",wx);const Px={arc:Cc,circle:kc,curve:class extends bc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),ak(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(fk.prototype,lk);const yk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new fk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",fk);const bk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,xk=Phaser.Utils.Objects.GetValue,Ck=Phaser.Math.Clamp;class kk extends bk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(xk(t,"progress",0)),this.setTransitionTargetTexture(xk(t,"toTexture","__DEFAULT"),xk(t,"toFrame",void 0),xk(t,"resizeMode",1)),this.setNoise(xk(t,"noiseX",void 0),xk(t,"noiseY",void 0),xk(t,"noiseZ",void 0)),this.setFromEdge(xk(t,"fromEdgeStart",.01),xk(t,"fromEdgeWidth",.05)),this.setToEdge(xk(t,"toEdgeStart",.01),xk(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Ck(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=wk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var wk={stretch:0,contain:1,cover:2};const Sk=Phaser.Utils.Array.SpliceOne,Pk=.1,Tk=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-wo(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-wo(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Yx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Yx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Sk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,kk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Pk,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Ok extends fk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Tk.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(cw.prototype,aw),t.register("fileDropZone",(function(t){var e=new cw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",cw);const uw=Phaser.Math.Wrap;var pw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const mw=Phaser.Utils.Objects.IsPlainObject,yw=Phaser.Utils.Objects.GetValue,bw=Phaser.Display.Align.CENTER,xw={min:0,full:-1};var Cw=function(t,e,i,s,r,n,a,o,h,l,d,c){Rv.call(this,t);var u=t.isRexSpace,p=typeof e;if(null===e)return this;if("number"===p);else if("string"===p)e=xw[e];else if(mw(e)){var g;e=yw(g=e,"proportion",void 0),i=yw(g,"align",bw),s=yw(g,"padding",0),r=yw(g,"expand",!1),n=yw(g,"key",void 0),a=yw(g,"index",void 0),t.isRexSizer||(o=yw(g,"minWidth",void 0),h=yw(g,"minHeight",void 0)),l=yw(g,"fitRatio",0),d=yw(g,"offsetX",0),c=yw(g,"offsetY",0)}return"string"==typeof i&&(i=Qg[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=bw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=An(t)/zn(t)),void 0===d&&(d=0),void 0===c&&(c=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=Ev(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=c,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?An(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},kw={add:Cw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Cw.call(this,new vw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return mw(i)&&(i.index=t),Cw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=fw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ww=Phaser.Utils.Array.Remove;var Sw={remove(t,e){return this.getParentSizer(t)!==this||(ww(this.sizerChildren,t),zv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kb.call(this,t),this}},Pw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Qg[e]),this.getSizerConfig(t).align=e,this}},Tw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ow={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Mw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ew={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(ef(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Zv.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,g=this.innerHeight,v=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=$v.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Uv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&pw.call(this,t,void 0),Nv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Kv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&pw.call(this,void 0,t),Jv.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Ew,kw,Sw,Pw,Tw,Ow,Mw);var _w=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Rw=Phaser.Utils.Objects.IsPlainObject,Lw=Phaser.Utils.Objects.GetValue;class Bw extends jb{constructor(t,e,i,s,r,n,a){Rw(e)?(e=Lw(a=e,"x",0),i=Lw(a,"y",0),s=Lw(a,"width",void 0),r=Lw(a,"height",void 0),n=Lw(a,"orientation",0)):Rw(s)?(s=Lw(a=s,"width",void 0),r=Lw(a,"height",void 0),n=Lw(a,"orientation",0)):Rw(n)&&(n=Lw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Lw(a,"space.item",0)),this.setStartChildIndex(Lw(a,"startChildIndex",0)),this.setRTL(Lw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_w.call(this)),this._childrenProportion}}Object.assign(Bw.prototype,Ew);var Iw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Dw={appendText:Mi,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class jw extends Bw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Iw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Iw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Iw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Iw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(jw.prototype,Dw);var Aw=function(t,e,i,s){var r=new tk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const zw=Phaser.GameObjects.Text;var Fw=function(t){return t instanceof zw};const Yw=Phaser.GameObjects.BitmapText;var Xw=function(t){return t instanceof Yw},Ww=function(t){return Xw(t)?2:Fw(t)?0:1},Vw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Hw=function(t,e){switch(Ww(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Vw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Uw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Xw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Fw(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Nw=65535;var $w=function(t,e,i){if(null==e)return t;if(0===e)return qw(t,0,i),t;var s=t.text.length;if(0===s)return qw(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=Jw(t,r,e,i,n),o=0;o<=Nw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Jw(t,r,e,i,n)}return o===Nw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),qw(t,e,i),t},Kw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Jw=function(t,e,i,s,r){var n,a=Kw(t,e,r),o=Kw(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},qw=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Zw=Phaser.Utils.Objects.GetValue;var Qw=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Zw(e,"minWidth",0),s=Zw(e,"minHeight",0),r=Zw(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return $w(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),$w(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const tS=Phaser.Utils.Objects.GetValue;class eS extends jw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=tS(e,"background",void 0),r=tS(e,"icon",void 0),n=tS(e,"iconMask",void 0),a=tS(e,"text",void 0),o=tS(e,"action",void 0),h=tS(e,"actionMask",void 0),l=tS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:tS(e,"space.icon",0),top:tS(e,"space.iconTop",0),bottom:tS(e,"space.iconBottom",0),left:tS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:tS(e,"space.icon",0),left:tS(e,"space.iconLeft",0),right:tS(e,"space.iconRight",0),top:tS(e,"space.iconTop",0)});var d=tS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Aw.call(this,r,r,1)),!d){var c=tS(e,"iconSize",void 0);this.setIconSize(tS(e,"iconWidth",c),tS(e,"iconHeight",c))}}if(a){var u=tS(e,"wrapText",!1),p=tS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Hw(a,u),e.expandTextWidth=!0,Uw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Qw(a,{fitHeight:!0}));var g,v,f=tS(e,"space.text",0),m=tS(e,"expandTextWidth",!1),y=tS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:tS(e,"space.actionTop",0),bottom:tS(e,"space.actionBottom",0),right:tS(e,"space.actionRight",0)}:{left:tS(e,"space.actionLeft",0),right:tS(e,"space.actionRight",0),bottom:tS(e,"space.actionBottom",0)},d=tS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Aw.call(this,o,o,1)),!d)){var b=tS(e,"actionSize");this.setActionSize(tS(e,"actionWidth",b),tS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const iS=Phaser.Utils.Objects.GetValue;var sS=function(t,e){var i=iS(e,"canvas"),s=iS(i,"width",128),r=iS(i,"height",128),n=new Mu(t,0,0,s,r);t.add.existing(n);var a=iS(i,"key"),o=iS(i,"frame"),h=iS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const rS=Phaser.Utils.Objects.GetValue;var nS=function(t,e){var i=rS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const aS=Phaser.Utils.Objects.GetValue,oS={accept:"image/*",multiple:!1};var hS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},lS={async openPromise(){var t=this;return Kk(this.scene.game,oS).then((function(e){return hS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},dS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(dS,lS);const cS=Phaser.Utils.Objects.GetValue;class uS extends eS{constructor(t,e){var i=function(t,e){var i=new Lk(t,{scaleUp:iS(e,"scaleUpIcon",!1),background:iS(e,"iconBackground"),image:sS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=nS(this,e),this.clickTarget&&(cS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new iw(e,oS);return e.add.existing(i),t.pin(i),i.on("change",(function(){hS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=nS(t,e);if(i){var s=aS(e,"click"),r=new hu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(uS.prototype,dS),t.register("imageInputLabel",(function(t){var e=new uS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",uS);let pS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const gS=Phaser.Utils.Objects.GetValue;class vS extends Ra{constructor(t,e){super(t,e),this.style=gS(e,"style",this);var i=gS(e,"propertiesMap");this.activeStyle=fS(e,"active",i),this.hoverStyle=fS(e,"hover",i),this.disableStyle=fS(e,"disable",i),this.onModifyStyle=gS(e,"onModifyStyle")}getStyle(t){return Bd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Id(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return mS.call(this,"active",t),this}setHoverState(t){return mS.call(this,"hover",t),this}setDisableState(t){return mS.call(this,"disable",t),this}}var fS=function(t,e,i){var s=Rd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},mS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},yS={addStyleManager(t){return this.styleManager=new vS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const bS=Phaser.GameObjects.Image,xS=Phaser.Utils.Objects.GetValue;class CS extends bS{constructor(t,e){void 0===e&&(e={}),super(t,xS(e,"x",0),xS(e,"y",0),xS(e,"key",""),xS(e,"frame",void 0)),this.type="rexStatesImage";var i=xS(e,"effects",!0);i&&Mn(this,i),this.style=new pS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(CS.prototype,yS),t.register("statesImage",(function(t){var e=new CS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",CS);class kS extends jt{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=wS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const wS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(kS.prototype,yS),t.register("statesRoundRectangle",(function(t){var e=new kS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",kS);let SS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const PS=Phaser.GameObjects.NineSlice,TS=Phaser.Utils.Objects.GetValue;class OS extends PS{constructor(t,e){void 0===e&&(e={}),super(t,TS(e,"x",0),TS(e,"y",0),TS(e,"key",null),TS(e,"frame",null),TS(e,"width",0),TS(e,"height",0),TS(e,"leftWidth",0),TS(e,"rightWidth",0),TS(e,"topHeight",0),TS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=TS(e,"effects",!0);i&&Mn(this,i),this.style=new SS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(OS.prototype,yS),t.register("statesNineSlice",(function(t){var e=new OS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",OS);let MS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const ES=Phaser.Utils.Objects.GetValue;class _S extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ES(e,"effects",!0);i&&Mn(this,i),this.style=new MS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,yS),t.register("statesNinePatch",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",_S);const RS=Phaser.GameObjects.Text,LS=Phaser.Utils.Objects.GetValue;class BS extends RS{constructor(t,e){void 0===e&&(e={}),super(t,LS(e,"x",0),LS(e,"y",0),LS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(BS.prototype,yS),t.register("statesText",(function(t){var e=new BS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",BS);class IS extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const DS=Phaser.GameObjects.BitmapText,jS=Phaser.Utils.Objects.GetValue;class AS extends DS{constructor(t,e){void 0===e&&(e={});var i=jS(e,"x",0),s=jS(e,"y",0),r=jS(e,"font",""),n=jS(e,"fontSize",!1),a=jS(e,"align",0),o=jS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=jS(e,"effects",!0);h&&Mn(this,h),this.style=new IS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(AS.prototype,yS),t.register("statesBitmapText",(function(t){var e=new AS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",AS);class zS extends dp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=FS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const FS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zS.prototype,yS),t.register("statesBarRectangle",(function(t){var e=new zS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",zS);var YS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let XS=class extends Mu{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var WS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,YS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return JS(this.sizerChildren,null),Kb.call(this,t),this}},ZS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)JS(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},iP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=$v.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,JS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)JS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},rP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const nP=Phaser.Utils.Objects.IsPlainObject,aP=Phaser.Utils.Objects.GetValue;class oP extends jb{constructor(t,e,i,s,r,n,a,o,h,l){nP(e)?(e=aP(l=e,"x",0),i=aP(l,"y",0),s=aP(l,"width",void 0),r=aP(l,"height",void 0),n=aP(l,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(s)?(s=aP(l=s,"width",void 0),r=aP(l,"height",void 0),n=aP(l,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(n)?(n=aP(l=n,"column",l.col||0),a=aP(l,"row",0),o=aP(l,"columnProportions",0),h=aP(l,"rowProportions",0)):nP(o)&&(o=aP(l=o,"columnProportions",0),h=aP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(aP(l,"createCellContainerCallback")),this.setIndentLeft(aP(l,"space.indentLeftOdd",0),aP(l,"space.indentLeftEven",0)),this.setIndentTop(aP(l,"space.indentTopOdd",0),aP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,aP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=sP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=rP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(oP.prototype,iP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new oP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",oP);var hP=function(t,e,i,s){return e/t<=i?e/(s-1):0},lP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=dP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=dP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const uP=Phaser.Utils.Objects.IsPlainObject,pP=Phaser.Utils.Objects.GetValue,gP=Phaser.Display.Align.CENTER;var vP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Rv.call(this,t),uP(e)&&(e=pP(r=e,"padding",0),i=pP(r,"key",void 0),s=pP(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=gP,r.padding=Ev(e),void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r},fP={add(t,e,i){if(Xm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Kb.call(this,t),this}},bP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const lT=Phaser.Utils.Objects.GetValue,dT=Phaser.Math.Distance.Between;class cT extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=lT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(lT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(lT(t,"enable",!0)),this.holdThreshold=lT(t,"holdThreshold",50),this.pointerOutReleaseEnable=lT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return rc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:dT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Ym(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Ym(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const uT=Phaser.Utils.Objects.GetValue;class pT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(uT(t,"value",0)),this.setSpeed(uT(t,"speed",0)),this.setAcceleration(uT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class gT{constructor(){this.value,this.dir,this.movement=new pT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const yT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},bT=Phaser.Utils.Objects.GetValue;class xT extends Ra{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=bT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(bT(e,"speed",.1)),this.setEnable(bT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(bT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Ym(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const CT=Phaser.Utils.Objects.GetValue;var kT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?CT(s,l,void 0):CT(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ve(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new oT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r);var p=CT(r,"position",0);"string"==typeof p&&(p=wT[p]);var g,v,f=CT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=CT(s,"space.slider",void 0))&&(o?f=0:g=CT(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:CT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:CT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:CT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:CT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=CT(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=CT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=CT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=CT(s,"scrollDetectionMode");"string"==typeof b&&(b=ST[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?CT(s,x,!0):CT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new mT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=CT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new xT(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const wT={right:0,left:1,bottom:0,top:1},ST={gameObject:0,rectBounds:1},PT=Phaser.Utils.Objects.GetValue;var TT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=PT(e,"width"),a=PT(e,"height");n||PT(e,"child.expandWidth",!0)||(s[1]=0),a||PT(e,"child.expandHeight",!0)||(r[1]=0);var o=new oP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=LP(i,"child"),r=LP(s,"gameObject",void 0);if(r){var n=LP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=LP(n,"top",0),a.bottom=LP(n,"bottom",0),o.left=LP(n,"left",0),o.right=LP(n,"right",0);break;case 1:a.top=LP(n,"left",0),a.bottom=LP(n,"right",0),o.top=LP(n,"top",0),o.bottom=LP(n,"bottom",0);break;default:a.top=LP(n,"top",0),a.bottom=LP(n,"bottom",0),a.left=LP(n,"left",0),a.right=LP(n,"right",0)}e.add(r,{column:1,row:1,align:LP(s,"align","center"),padding:o,expand:{width:LP(s,"expandWidth",!0),height:LP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:kT(t,o,"y",e);break;case 1:kT(t,o,"x",e);break;default:kT(t,o,"y",e),kT(t,o,"x",e)}return o},OT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},MT=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},ET=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},jT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},AT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},zT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},FT=function(t,e){switch(Ww(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},YT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&XT.call(this)},XT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},WT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},VT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=DT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(jT.call(this,-this.textOY)),0),e=AT.call(this,t)+this.textOY,i=zT.call(this,t);return FT(this.textObject,i),this.textObject.rexSizer.offsetY=e,YT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Zv.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,WT.call(this,t,n,a),wv(t,s,r,n,a,e.align),e.preOffsetY=0,YT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const GT=Phaser.Utils.Objects.IsPlainObject,HT=Phaser.Utils.Objects.GetValue,UT=Phaser.Display.Align.TOP_LEFT;class NT extends jb{constructor(t,e,i,s,r,n){GT(e)?(e=HT(n=e,"x",0),i=HT(n,"y",0),s=HT(n,"width",void 0),r=HT(n,"height",void 0)):GT(s)&&(s=HT(n=s,"width",void 0),r=HT(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=HT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(HT(n,"clampTextOY",!0)),this.alwaysScrollable=HT(n,"alwaysScrollable",!1);var a=HT(n,"background",void 0),o=HT(n,"text",void 0);void 0===o&&(o=$T(t)),this.textCropEnable=HT(n,"textCrop",!!o.setCrop);var h=HT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=UT,l.padding=Ev(0),l.expand=!0,this.textObject=o,this.textObjectType=Ww(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Aw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(jT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=AT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var $T=function(t){return t.add.text(0,0,"")};Object.assign(NT.prototype,VT);var KT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},JT={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const qT=Phaser.Utils.Objects.GetValue;class ZT extends BT{constructor(t,e){void 0===e&&(e={});var i=qT(e,"text",void 0),s=qT(e,"textWidth",void 0),r=qT(e,"textHeight",void 0),n=qT(e,"textCrop",!!i.setCrop),a=qT(e,"textMask",!n),o=qT(e,"content",""),h=new NT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:qT(e,"clampChildOY",!1),alwaysScrollable:qT(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=qT(e,"space",void 0);l&&(l.child=qT(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(ZT.prototype,KT,JT);const QT=Phaser.Utils.Objects.GetValue;var tO=function(t,e,s){e=e?i(e):{};var r=QT(s,"background",MP),n=QT(s,"text",eO),a=QT(s,"track",MP),o=QT(s,"thumb",MP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new ZT(t,e);return t.add.existing(l),l},eO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new AS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new nO(t,e);break;case"textarea":s=tO(t,e);break;default:s=new BS(t,e)}return OP(s,e),t.add.existing(s),s},iO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _S(t,e):new OS(t,e);break;case"roundRectangle":s=new kS(t,e);break;default:s=new CS(t,e)}return OP(s,e),t.add.existing(s),s};const sO=Phaser.Utils.Objects.GetValue;var rO=function(t,e,s){e=e?i(e):{};var r=sO(s,"background",MP),n=sO(s,"text",eO),a=sO(s,"icon",iO),o=sO(s,"action",iO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class nO extends eS{constructor(t,e,i){super(t,e=rO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return aO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return aO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return aO(this.getChildren(),"setDisableState",t),this}}var aO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=SO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Xm(s)||(s=Bc(EO,i,1)),SO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=RO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=_O[t]),this.timeUnit=t,this}}var EO=[];const _O={ms:0,s:1,sec:1},RO={abs:0,absolute:0,inc:1,increment:1};var LO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},BO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const IO=Phaser.Utils.Objects.GetValue;class DO extends kO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(IO(e,"easeDuration",1e3)),this.levelCounter=new wO(IO(e,"levelCounter")),this.player=new MO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",LO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(DO.prototype,BO),t.register("expBar",(function(t){var e=new DO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",DO);const jO=Bw.prototype.add,AO=Bw.prototype.addSpace;var zO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&AO.call(this),jO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&AO.call(this),this.hasTailSpace=s}else jO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;jO.call(this,t,{index:r,proportion:i,expand:!0})}else jO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},FO={addButton(t){if(Xm(t))for(var e=t,i=0,s=e.length;i=0;i--)WO.call(this,e[i],t);return this}},GO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},HO=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,GO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},UO={add(t){return this.buttons.push(t),t._click||(t._click=new hu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),HO.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)hM.call(this,e[i],t);return this}};const dM=Phaser.Utils.Objects.GetValue;class cM extends oP{constructor(t,e){void 0===e&&(e={});var i=dM(e,"row",0),s=dM(e,"column",e.col||0),r=dM(e,"createCellContainerCallback"),n=dM(e,"buttons",void 0),a=dM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&uM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)mM.call(this,e[i],t);return this}};const bM=Phaser.Utils.Objects.GetValue;class xM extends SP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new QO({parent:this,eventEmitter:bM(e,"eventEmitter",this),groupName:bM(e,"groupName",void 0),clickConfig:bM(e,"click",void 0)}).setButtonsType(e);var s=bM(e,"background",void 0),r=bM(e,"buttons",void 0);this.buttonsAlign=bM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(xM.prototype,gM,yM,ZO,eM),t.register("fixWidthButtons",(function(t){var e=new xM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",xM);var CM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const kM=Phaser.Utils.Objects.GetValue;class wM extends eS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new iw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(kM(e,"accept","")),this.setMultiple(kM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(wM.prototype,CM),t.register("fileSelectorButton",(function(t){var e=new wM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",wM);var SM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},PM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Dm.modal.call(this,t,e),this}},TM={};Object.assign(TM,SM,PM);const OM=Phaser.Utils.Objects.GetValue;class MM extends Bw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=OM(e,"eventEmitter",this);var i,s,r,n,a=OM(e,"background",void 0),o=OM(e,"title",void 0),h=OM(e,"toolbar",void 0),l=OM(e,"toolbarBackground",void 0),d=OM(e,"leftToolbar",void 0),c=OM(e,"leftToolbarBackground",void 0),u=OM(e,"content",void 0),p=OM(e,"description",void 0),g=OM(e,"choices",void 0),v=OM(e,"choicesBackground",void 0),f=OM(e,"actions",void 0),m=OM(e,"actionsBackground",void 0),y=OM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new sM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:OM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new sM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:OM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&OM(e,"expand.title",!0),C=OM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Bw(t,{orientation:0}):new ex(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:OM(e,"space.titleLeft",0),right:OM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:OM(e,"space.title",0),top:OM(e,"space.titleTop",0)}),P=OM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=OM(e,"align.content","center"),O=OM(e,"space.content",0),M=(S={left:OM(e,"space.contentLeft",0),right:OM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=OM(e,"proportion.content",0),OM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=OM(e,"align.description","center");var E=OM(e,"space.description",0);S={left:OM(e,"space.descriptionLeft",0),right:OM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=OM(e,"proportion.description",0),M=OM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=OM(e,"choicesType","").split("-"),R=EM(_,"wrap")?xM:EM(_,"grid")?cM:sM,L=EM(_,"radio")?"radio":EM(_,"checkboxes")?"checkboxes":void 0,B={left:OM(e,"space.choicesBackgroundLeft",0),right:OM(e,"space.choicesBackgroundRight",0),top:OM(e,"space.choicesBackgroundTop",0),bottom:OM(e,"space.choicesBackgroundBottom",0)},I=OM(e,"space.choice",0);R===sM?B.item=I:R===xM?(B.item=I,B.line=OM(e,"space.choiceLine",I)):(B.column=OM(e,"space.choiceColumn",I),B.row=OM(e,"space.choiceRow",I));var D={width:OM(e,"choicesWidth",void 0),height:OM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:OM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:OM(e,"choicesSetValueCallbackScope",void 0)};R===sM&&(D.orientation=EM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=OM(e,"space.choices",0);S={left:OM(e,"space.choicesLeft",0),right:OM(e,"space.choicesRight",0),bottom:f?j:0},T=OM(e,"align.choices","center"),P=OM(e,"proportion.choices",0),M=OM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new sM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:OM(e,"space.action",0)},expand:OM(e,"expand.actions",!1),align:OM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:OM(e,"space.actionsLeft",0),right:OM(e,"space.actionsRight",0),bottom:OM(e,"space.actionsBottom",0)},P=OM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),RM(this,"click"),RM(this,"over"),RM(this,"out"),RM(this,"enable"),RM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var EM=function(t,e){return-1!==t.indexOf(e)},_M={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},RM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){_M.hasOwnProperty(s)&&t.emit(`${_M[s]}.${e}`,i,r,n,a)}))};Object.assign(MM.prototype,TM),t.register("dialog",(function(t){var e=new MM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",MM);var LM=function(t,e,i){var s=new nO(t,e,i);return t.add.existing(s),s},BM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},IM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},DM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=VE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(j_.prototype,L_);const A_=["top","bottom","centerY","center"],z_=["left","right","centerX","center"];var F_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=A_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=z_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Y_=Phaser.Utils.Objects.GetValue;class X_ extends BT{constructor(t,e){void 0===e&&(e={});var i=_P(e),s=Y_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Y_(e,"clampChildOY",!1),s.clampChildOX=Y_(e,"clampChildOX",!1);var r,n,a=new j_(t,s);switch(t.add.existing(a),i){case 0:r=Y_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Y_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Y_(e,"align.panel","center")};var o=Y_(e,"space",void 0);o&&(o.child=Y_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Bb(this.childrenMap.child,t),this}}var W_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:F_.call(this,t,"y",e);break;case 1:F_.call(this,t,"x",e);break;default:F_.call(this,t,"y",e),F_.call(this,t,"x",e)}return this}};Object.assign(X_.prototype,W_);const V_=Phaser.Utils.Objects.GetValue;var G_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=H_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=U_(e,this.listCreateSliderTrackCallback),g=U_(e,this.listCreateSliderThumbCallback);d=new X_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:V_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=H_(e,u),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},H_=function(t,e,i){var s;return i?(e.orientation="x",s=new xM(t,e)):(e.orientation="y",s=new sM(t,e)),t.add.existing(s),s},U_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const N_=Phaser.Utils.Objects.GetValue;var $_=function(t,e){var i=N_(e,"expandDirection",void 0);"string"==typeof i&&(i=K_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Td(s=e,r="alignTarget")?J(s,r):n&&Td(s,n)?J(s,n):a&&Td(s,a)?J(s,a):o),c=N_(e,"alignTargetY",d),u=N_(e,"alignOffsetX",0),p=N_(e,"alignOffsetY",0),g=N_(e,"alignSide","").includes("right"),v=N_(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=aa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const K_={down:0,up:1},J_=Phaser.Utils.Objects.GetValue;class q_ extends mm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){gf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new uf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),$_(t,e),t.isRexSizer&&t.layout();var i=J_(e,"touchOutsideClose",!1),s=J_(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Mm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Z_={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Q_={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=G_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new q_(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Q_,__,Z_);const tR=Phaser.Utils.Objects.GetValue;class eR extends eS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(tR(e,"options"));var i=tR(e,"list");this.setWrapEnable(tR(i,"wrap",!1)),this.setCreateButtonCallback(tR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(tR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(tR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(tR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(tR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(tR(i,"scroller")),this.setListMouseWheelScrollerConfig(tR(i,"mouseWheelScroller")),this.setButtonClickCallback(tR(i,"onButtonClick")),this.setButtonOverCallback(tR(i,"onButtonOver")),this.setButtonOutCallback(tR(i,"onButtonOut")),this.setListExpandDirection(tR(i,"expandDirection")),this.setListEaseInDuration(tR(i,"easeIn",500)),this.setListEaseOutDuration(tR(i,"easeOut",100)),this.setListTransitInCallback(tR(i,"transitIn")),this.settListTransitOutCallback(tR(i,"transitOut")),this.setListMaxHeight(tR(i,"maxHeight",0)),this.setListSize(tR(i,"width"),tR(i,"height",0)),this.setListAlignmentMode(tR(i,"alignParent","text")),this.setListAlignmentSide(tR(i,"alignSide","")),this.setListBounds(tR(i,"bounds")),this.setListSpace(tR(i,"space")),this.setListDraggable(tR(i,"draggable",!1)),this.setValueChangeCallback(tR(e,"setValueCallback"),tR(e,"setValueCallbackScope")),this.setValue(tR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(eR.prototype,Q_),t.register("dropDownList",(function(t){var e=new eR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",eR);var iR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=rO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=LM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return MP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return MP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class sR extends eR{constructor(t,e,i){super(t,e=iR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(hR,rR,aR,oR);const lR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class dR extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ww(this.parent),this.pageStartIndexes=[],this.lines=DT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(lR(t,"maxLines",void 0)),this.setPageBreak(lR(t,"pageBreak","\f\n")),this.setText(lR(t,"text","")),this.startLineIndex=lR(t,"start",-1),this.endLineIndex=lR(t,"end",void 0);var e=lR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(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,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){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,s;switch(Ww(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(dR.prototype,hR);var cR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?FT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Ae(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},uR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},pR=function(t,e){for(var i=void 0,s=0;s0?gR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=gR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},fR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=uR(this.parent,t);n=pR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)vR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(fR,cR);const mR=Phaser.Utils.Objects.GetFastValue,yR=Phaser.Utils.Objects.GetValue;class bR extends Ra{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(yR(t,"wrap",!1)),this.setTypeMode(yR(t,"typeMode",0)),this.setTypingSpeed(yR(t,"speed",333)),this.setTextCallback=mR(t,"setTextCallback",null),this.setTextCallbackScope=mR(t,"setTextCallbackScope",null),this.setTypingContent(mR(t,"text","")),this.typingIndex=mR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=mR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=xR[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Ae(t);this.textWrapEnable&&(e=function(t,e){switch(Ww(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}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=uR(this.parent,this.text).length,this}onTyping(){var t=vR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(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}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?FT(this.parent,t):this.parent.setText(t)}}const xR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(bR.prototype,fR);const CR=Phaser.Utils.Objects.GetValue,kR={page:0,line:1};class wR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=CR(i,"expandTextWidth",!1),n=CR(i,"expandTextHeight",!1);if(r||n){var a=Ww(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(CR(i,"typingMode","page")),this.page=new dR(s,CR(i,"page",void 0)),this.typing=new bR(s,CR(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=kR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(cO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new wR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",wR);class SR extends wR{constructor(t,e,i){super(t,e=pO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new SR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",SR);const PR=Phaser.Utils.Objects.GetValue;class TR extends Bw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=PR(e,"background",void 0),a=PR(e,"icon",void 0),o=PR(e,"iconMask",void 0),h=PR(e,"slider",void 0),l=PR(e,"text",void 0),d=PR(e,"space.icon",0),c=PR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Aw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new sT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===PR(h,"width",void 0)?1:0:void 0===PR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=PR(e,"valuechangeCallback",null);if(null!==u){var p=PR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(PR(e,"enable",void 0)),this.setValue(PR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new TR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",TR),t.register("scrollBar",(function(t){var e=new oT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",oT);const OR=Phaser.Utils.Objects.GetValue,MR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class ER extends ex{constructor(t,e){super(t,e),this.type="rexBadge";var i=OR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=OR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),MR){var n=OR(e,r,void 0);n&&(this.add(n,{key:r,align:MR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new ER(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",ER);const _R=ex.prototype.add;var RR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),_R.call(this,t,e,i,s,r,n,a,o,h),this},LR={add:RR,addPage:RR};const BR=Jg.prototype.setChildVisible;var IR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(BR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(BR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(IR,LR);const DR=Phaser.Utils.Objects.GetValue;class jR extends ex{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(DR(e,"swapMode",0)),this.setFadeInDuration(DR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=AR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(jR.prototype,IR);const AR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new jR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",jR);const zR=Phaser.GameObjects.Mesh;class FR extends zR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const YR=Phaser.Math.Vector3,XR=Phaser.Math.Matrix4;var WR=new YR,VR=new YR,GR=new XR;const HR=Phaser.Utils.Objects.IsPlainObject,UR=Phaser.Utils.Objects.GetValue,NR=Phaser.Geom.Mesh.GenerateGridVerts,$R=Phaser.Math.RadToDeg,KR=Phaser.Math.DegToRad,JR=1+1/Math.sin(KR(45));let qR=class extends FR{constructor(t,e,i,s,r,n){HR(e)&&(e=UR(n=e,"x",0),i=UR(n,"y",0),s=UR(n,"key",null),r=UR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(JR),this.hideCCW=UR(n,"hideCCW",!0);var a=UR(n,"gridWidth",0),o=UR(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,NR({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return $R(this.rotationX)}set angleX(t){this.rotationX=KR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return $R(this.rotationY)}set angleY(t){this.rotationY=KR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return $R(this.rotationZ)}set angleZ(t){this.rotationZ=KR(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),WR.set(e,i,s),VR.set(r,n,a),GR.fromRotationXYTranslation(VR,WR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},AL={top:1,left:3,right:5,bottom:7},zL={top:"bottom",left:"right",right:"left",bottom:"top"},FL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},YL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}XB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},GB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(FB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;YB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return VB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),YB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new FI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},XI={openColorPicker:function(){if(!this.colorPicker){var t=YI.call(this).layout(),e=new q_(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(XI,hI);const WI=Phaser.Utils.Objects.GetValue;class VI extends oI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(WI(i,"width",160),WI(i,"height",170));var n=WI(i,"background");r=n?function(t){return MP(t,n)}:WI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(WI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(WI(i,"expandDirection")),this.setColorPickerEaseInDuration(WI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(WI(i,"easeOut",200)),this.setColorPickerTransitInCallback(WI(i,"transitIn")),this.setColorPickerTransitOutCallback(WI(i,"transitOut")),this.setColorPickerBounds(WI(i,"bounds"));var a=WI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(WI(o,"height",30)),this.setColorComponentsFormatLabelConfig(WI(o,"formatLabel"));var h=WI(o,"inputText");h||(h=WI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=WI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(VI.prototype,XI),t.register("colorInput",(function(t){var e=new VI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",VI),t.register("colorInputLite",(function(t){var e=new oI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",oI),t.register("colorPicker",(function(t){var e=new _I(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",_I),t.register("colorComponents",(function(t){var e=new AI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",AI);var GI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&x * @copyright 2019 Photon Storm Ltd. diff --git a/examples/test/test-ui.js b/examples/test/test-ui.js index 6988b6d2c4..a2f0590f32 100644 --- a/examples/test/test-ui.js +++ b/examples/test/test-ui.js @@ -11,6 +11,43 @@ class Demo extends Phaser.Scene { preload() { } create() { + this.add + .rectangle(160, 160, 240, 360) + .setFillStyle(0x880000) + .setOrigin(0, 0); + + var sizer = this.rexUI.add.sizer({ + orientation: 'y', + x: 160, + y: 160, + width: 240, + height: 360, + origin: 0, + }) + .addBackground( + this.add + .rectangle(0, 0, 0, 0) + .setFillStyle(0x008800) + .setOrigin(0, 0), + ) + + for (let i = 0; i < 6; i++) { + let child = this.add.text(0, 0, `${i} TEXT`, { + fixedWidth: 240, + fixedHeight: 40, + backgroundColor: 'grey' + }) + + sizer.add( + this.add.container() + .add(child) + .setSize(240, 40), + { offsetX: -120, offsetY: -20 } + ); + } + + sizer.layout() + } update() { } diff --git a/templates/ui/overlapsizer/AddChildMethods.js b/templates/ui/overlapsizer/AddChildMethods.js index da5e422b33..533abffa95 100644 --- a/templates/ui/overlapsizer/AddChildMethods.js +++ b/templates/ui/overlapsizer/AddChildMethods.js @@ -57,6 +57,7 @@ var Add = function (gameObject, childKey, align, padding, expand, minWidth, minH minHeight = gameObject._minHeight; } } + if (offsetX === undefined) { offsetX = 0; } diff --git a/templates/ui/sizer/AddChildMethods.js b/templates/ui/sizer/AddChildMethods.js index b4aa298e3a..0346dd4e85 100644 --- a/templates/ui/sizer/AddChildMethods.js +++ b/templates/ui/sizer/AddChildMethods.js @@ -19,6 +19,7 @@ var Add = function ( childKey, index, minWidth, minHeight, fitRatio, + offsetX, offsetY, ) { AddChild.call(this, gameObject); @@ -46,6 +47,9 @@ var Add = function ( } fitRatio = GetValue(config, 'fitRatio', 0); // width/height + + offsetX = GetValue(config, 'offsetX', 0); + offsetY = GetValue(config, 'offsetY', 0); } if (typeof (align) === 'string') { @@ -86,12 +90,21 @@ var Add = function ( fitRatio = GetDisplayWidth(gameObject) / GetDisplayHeight(gameObject); } + if (offsetX === undefined) { + offsetX = 0; + } + if (offsetY === undefined) { + offsetY = 0; + } + var config = this.getSizerConfig(gameObject); config.proportion = proportion; config.align = align; config.padding = GetBoundsConfig(paddingConfig); config.expand = expand; config.fitRatio = (proportion === 0) ? fitRatio : 0; + config.alignOffsetX = offsetX; + config.alignOffsetY = offsetY; if ((index === undefined) || (index >= this.sizerChildren.length)) { this.sizerChildren.push(gameObject); diff --git a/templates/ui/sizer/LayoutChildren.js b/templates/ui/sizer/LayoutChildren.js index bb0991d9a5..3e83ab0820 100644 --- a/templates/ui/sizer/LayoutChildren.js +++ b/templates/ui/sizer/LayoutChildren.js @@ -8,7 +8,7 @@ const Wrap = Phaser.Math.Wrap; var LayoutChildren = function () { var children = this.sizerChildren; - var child, sizerConfig, padding; + var child, childConfig, padding; var startX = this.innerLeft, startY = this.innerTop; var innerWidth = this.innerWidth; @@ -34,8 +34,8 @@ var LayoutChildren = function () { continue; } - sizerConfig = child.rexSizer; - padding = sizerConfig.padding; + childConfig = child.rexSizer; + padding = childConfig.padding; PreLayoutChild.call(this, child); @@ -64,10 +64,10 @@ var LayoutChildren = function () { // Set position if (this.orientation === 0) { // x x = itemX + (padding.left * this.scaleX); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { width = childWidth; } else { - width = (sizerConfig.proportion * this.proportionLength); + width = (childConfig.proportion * this.proportionLength); } y = itemY + (padding.top * this.scaleY); @@ -77,14 +77,17 @@ var LayoutChildren = function () { width = innerWidth - ((padding.left + padding.right) * this.scaleX); y = itemY + (padding.top * this.scaleY); - if ((sizerConfig.proportion === 0) || (this.proportionLength === 0)) { + if ((childConfig.proportion === 0) || (this.proportionLength === 0)) { height = childHeight; } else { - height = (sizerConfig.proportion * this.proportionLength); + height = (childConfig.proportion * this.proportionLength); } } - LayoutChild.call(this, child, x, y, width, height, sizerConfig.align); + LayoutChild.call(this, + child, x, y, width, height, childConfig.align, + childConfig.alignOffsetX, childConfig.alignOffsetY + ); if (this.orientation === 0) { // x itemX += (width + ((padding.left + padding.right) * this.scaleX) + (this.space.item * this.scaleX)); diff --git a/templates/ui/sizer/Sizer.d.ts b/templates/ui/sizer/Sizer.d.ts index 6091198ced..f4abc12264 100644 --- a/templates/ui/sizer/Sizer.d.ts +++ b/templates/ui/sizer/Sizer.d.ts @@ -44,6 +44,8 @@ declare namespace Sizer { minWidth?: number, minHeight?: number, fitRatio?: number, + offsetX?: number, + offsetY?: number, } } @@ -102,6 +104,8 @@ declare class Sizer extends BaseSizer { minWidth?: number, minHeight?: number, fitRatio?: number | boolean, + offsetX?: number, + offsetY?: number, ): this; insert(